接著昨天的場景,雖然將Windows Server 2012 Core的默認(rèn)控制臺設(shè)置成了PowerShell,還啟用了遠(yuǎn)程桌面,但是對于Core版本的服務(wù)器來講,遠(yuǎn)程桌面形同雞肋,所以我想啟用PowerShell遠(yuǎn)程訪問,在服務(wù)器上以管理員權(quán)限運(yùn)行:
Enable-PSRemoting -Force
在嘗試建立遠(yuǎn)程連接時(shí),提示訪問被拒絕,此時(shí)可能是防火墻問題:我需要使用PowerShell添加PowerShell遠(yuǎn)程防火墻規(guī)則:
New-NetFirewallRule -Name powershell-remote-tcp -Direction Inbound -DisplayName 'PowerShell遠(yuǎn)程連接 TCP' -LocalPort 5985-5996 -Protocol 'TCP'New-NetFirewallRule -Name powershell-remote-udp -Direction Inbound -DisplayName 'PowerShell遠(yuǎn)程連接 UDP' -LocalPort 5985-5996 -Protocol 'UDP'
再次嘗試建立連接:
PS> Enter-PSSession -ComputerName 192.168.1.15 -Credential administrator[192.168.1.15]: PS C:/Users/Administrator/Documents> hostnameAD-2012
新聞熱點(diǎn)
疑難解答
圖片精選