必尽通过Powershell来管理服务器是非常麻烦的,所以能用上服务器系统自带的MMC的图形界面来管理远程服务器是再好不过的了…..
启用远程PowerShell
允许通过管理服务器执行远程PowerShell命令
Enable-PSRemoting
1.想要使用MMC管理远程的Windows Server Core服务器,需要先在远程服务器上打开一些防火墙规则
#
# This script works on a variety of settings that are easiest done from the
# local machine to make it remotely manageable by a management workstation.
# Ensure Server Manager remoting is enabled
Configure-SMRemoting.exe -Enable
# 设置一些防火墙规则
# 允许Ping
Set-NetFirewallRule –Name "FPS-ICMP4-ERQ-In" –Enabled True
Set-NetFirewallRule –Name "FPS-ICMP6-ERQ-In" –Enabled True
Set-NetFirewallRule –Name "FPS-ICMP4-ERQ-Out" –Enabled True
Set-NetFirewallRule –Name "FPS-ICMP6-ERQ-Out" –Enabled True
# Enable remote volume management - firewall rules need to be set on both
# source and destination computers
# ***NOTE*** Policy must also be set on system to "Allow remote access
# to the Plug and Play interface"
# This is done with gpedit.msc locally or gpedit for domain policy
Set-NetFirewallRule –Name "RVM-VDS-In-TCP" –Enabled True
Set-NetFirewallRule –Name "RVM-VDSLDR-In-TCP" –Enabled True
Set-NetFirewallRule –Name "RVM-RPCSS-In-TCP" –Enabled True
# 允许 DCOM 管理入站规则(因为其它功能可能会打开DCOM-IN,所以有可能会报错找不到对象,不影响)
Set-NetFirewallRule –Name "ComPlusNetworkAccess-DCOM-In" –Enabled True
# Enable remote service management
Set-NetFirewallRule –Name "RemoteSvcAdmin-In-TCP" –Enabled True
Set-NetFirewallRule –Name "RemoteSvcAdmin-NP-In-TCP" –Enabled True
Set-NetFirewallRule –Name "RemoteSvcAdmin-RPCSS-In-TCP" –Enabled True
# Enable Remote Event Log Management
Set-NetFirewallRule –Name "RemoteEventLogSvc-In-TCP" –Enabled True
Set-NetFirewallRule –Name "RemoteEventLogSvc-NP-In-TCP" –Enabled True
Set-NetFirewallRule –Name "RemoteEventLogSvc-RPCSS-In-TCP" –Enabled True
# Enable Remote Scheduled Tasks Management
Set-NetFirewallRule –Name "RemoteTask-In-TCP" –Enabled True
Set-NetFirewallRule –Name "RemoteTask-RPCSS-In-TCP" –Enabled True
# Enable Windows Firewall Remote Management
Set-NetFirewallRule –Name "RemoteFwAdmin-In-TCP" –Enabled True
Set-NetFirewallRule –Name "RemoteFwAdmin-RPCSS-In-TCP" –Enabled True
# Enable WMI management requests in
Set-NetFirewallRule –Name "WMI-WINMGMT-In-TCP" –Enabled True
# Set some services to automatically start and start them.
Set-Service -Name PlugPlay -StartupType Automatic
Start-Service PlugPlay
Set-Service -Name RemoteRegistry -StartupType Automatic
Start-Service RemoteRegistry
Set-Service -Name vds -StartupType Automatic
Start-Service vds
# Enable Remote Desktop
(Get-WmiObject Win32_TerminalServiceSetting -Namespace root\cimv2\TerminalServices).SetAllowTsConnections(1,1) | Out-Null
(Get-WmiObject -Class "Win32_TSGeneralSetting" -Namespace root\cimv2\TerminalServices -Filter "TerminalName='RDP-tcp'").SetUserAuthenticationRequired(0) | Out-Null
$srvr = Read-Host "Enter name to assign to this computer:"
(Get-WmiObject win32_computersystem).rename($srvr)
$domain = Read-Host "Enter domain this computer should join (you will be prompted for credentials):"
Add-Copmuter -DomainName $domain
Write-Host -ForegroundColor Yellow "System will now be rebooted."
Shutdown -r -t 5
2.在服务管理器>仪表板选择”添加要管理的其他服务器”,如果没有域,则面弹出机板中通过DNS选项添加IP地址
3.在服务管理器>所有服务器中>选中刚添加的服务器>右键选择”管理方式…”
4.输入用户帐户和密码,注意! 非域用户需要输入”IP地址\administrator”
5.右键选中新添加的服务器,试试管理功能吧
OpenSSH.Server安装与配置
# 一般安装服务器端即可
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
Set-Service -Name sshd -StartupType 'Automatic'
Start-Service sshd
# 查看服务状态
PS C:\Windows\system32> get-service sshd
Status Name DisplayName
------ ---- -----------
Running sshd OpenSSH SSH Server
# 如果你想在服务器通过SSH管理其它服务器,就需要安装SSH客户端工具
Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0
Set-Service -Name ssh-agent -StartupType 'Automatic'
Start-Service ssh-agent
# 连接客户端
ssh username@domain@hostname_or_IP_address
通过SecureCRT连接Windows Server 2019 Core
连接成功
链接:https://www.jianshu.com/p/ef4560d727fb
https://kknews.cc/code/oqnmp86.html