Hello,
I am having an issue with PowerShell remoting on some PCs.
Using an administrator command prompt, I have used PSTools to enable PowerShell remoting for specific PC. i.e C:\Installs\SysinternalsSuite\PsExec64.exe \PCName -s powershell Enable-PSRemoting –Force
It returns with the following showing it was enabled successfully.
PsExec v2.34 - Execute processes remotely
Copyright (C) 2001-2021 Mark Russinovich
Sysinternals - www.sysinternals.com
WinRM is already set up to receive requests on this computer.
WinRM is already set up for remote management on this computer.
WARNING: Waiting for service ‘Windows Remote Management (WS-Management) (winrm)’ to stop…
powershell exited on PCName with error code 0.
I can then use Enter-PSSession PCname to open a session and run a command I need to run and Exit-PSSession to close the session.
The problem is that it is not working for all PCs. For some PCs when I start a PowerShell remote session using Enter-PSSession, it fails, even though the enable command above completes successfully for that PC.
I receive the following error:
Enter-PSSession : Connecting to remote server PCName failed with the following error message : WinRM cannot complete the operation. Verify that the specified computer name is valid, that the computer is accessible over the network, and that a firewall exception for the WinRM service is enabled and allows access from this computer. By default, the WinRM firewall exception for public profiles limits access to remote computers within the same local subnet. For more information, see the about_Remote_Troubleshooting Help topic.
At line:1 char:1
- Enter-PSSession PCName
-
- CategoryInfo : InvalidArgument: (PCName:String) [Enter-PSSession], PSRemotingTransportException
- FullyQualifiedErrorId : CreateRemoteRunspaceFailed
I verified the PC name is valid, the computer is accessible on the network and a firewall exception for the WinRM service is enabled. I believe this is typically done when the PsTools command completes successfully.
What am I missing that would explain why it works on some PCs but not on others, even though the PSTools results in successfully being enabled? I also tested by setting up PowerShell remoting using https://support.auvik.com/hc/en-us/articles/204424994-How-to-enable-WinRM-with-domain-controller-Gro…
However, when I test I still cannot use Enter-PSSession for some PCs. What am I doing wrong?
Thanks,
Roger