If Powershell remoting is not working between two servers check this:
- Check if winrm service is running. Full name is Windows Remote Management (WS-Management)
- Execute winrm quickconfig
- Enable-PSRemoting -Force command on server.
- Get-ExecutionPolicy -List to check that you can execute…
- Check that winrm port is the same as listener port
- Winrm port: winrm get winrm/config
- Listener port: winrm enumerate winrm/config/listener
- Change listener port by (from elevated cmd!!!):
Winrm set winrm/config/listener?Address=*+Transport=HTTP @{Port=”5985″}
- Check Windows Firewall is not blocking port.
- Check that choosen port (5985 or 81) is open (Cryping, NMap)
- Check TrustedHosts list
|
Get-Item WSMan:\localhost\Client\TrustedHosts Set-Item WSMan:\localhost\Client\TrustedHosts -value * Restart-Service winrm -Force |
- Test with Invoke-Command -ComputerName SERVER -Port 5985 -ScriptBlock {“C:\Program files” | Get-ChildItem}
- Test Invoke-Command with Credentials
|
$server="xxxx" $remotingPort=5985 $Username = 'yyyy' $Password = 'zzzz' $pass = ConvertTo-SecureString -AsPlainText $Password -Force $Cred = New-Object System.Management.Automation.PSCredential -ArgumentList $Username,$pass Invoke-Command -ComputerName $server -Port $remotingPort -ScriptBlock {“C:\Program files” | Get-ChildItem} -Credential $Cred |