我尝试了无数种方法来实现这一点,但就是无法解决。
我正在尝试远程配置 RDS,但它一直告诉我Unable to connect to the server by using Windows PowerShell remoting
。
我已经运行了Enable-PSRemoting -Force -SkipNetworkProfileCheck
,但是它仍然不起作用。
这也在同一台服务器上运行,并且我已禁用 IPv6。
PS C:\Windows\system32> Invoke-Command -ComputerName $server -Credential $creds -ScriptBlock {param($srv) New-RDSessionDeployment -ConnectionBroker $srv -WebAccessServer $srv -SessionHost $srv} -ArgumentList $server
Validation failed for the "RD Connection Broker" parameter.
EC2AMAZ-VN782KT.directory.local Unable to connect to the server by using Windows PowerShell remoting. Verify that you can connect to the server.
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,New-RDSessionDeployment
+ PSComputerName : EC2AMAZ-VN782KT.directory.local
我也尝试过这种方法
PS C:\Windows\system32> Enter-PSSession -ComputerName $server -Credential $creds
[EC2AMAZ-VN782KT.directory.local]: PS C:\Users\Admin\Documents> whoami
directory\admin
[EC2AMAZ-VN782KT.directory.local]: PS C:\Users\Admin\Documents> $server = (Get-WmiObject win32_computersystem).DNSHostName + "." + (Get-WmiObject win32_computersystem).Domain
[EC2AMAZ-VN782KT.directory.local]: PS C:\Users\Admin\Documents> New-RDSessionDeployment -ConnectionBroker $server -WebAccessServer $server -SessionHost $server
New-RDSessionDeployment : Validation failed for the "RD Connection Broker" parameter.
EC2AMAZ-VN782KT.directory.local Unable to connect to the server by using Windows PowerShell remoting. Verify that you can connect to the server.
At line:1 char:1
+ New-RDSessionDeployment -ConnectionBroker $server -WebAccessServer $s ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,New-RDSessionDeployment
但是,如果我运行以下命令,它就可以工作,这说明远程处理正在运行!
PS C:\Windows\system32> Invoke-Command -ComputerName $server -Credential $creds -ScriptBlock {param($server) Write-Output $server } -ArgumentList '123'
123