PowerShell problems when using invoke-command
Posted on 2014-02-16
Within a PowerShell window, when trying to use "invoke-command" on my local host, I am able to execute a script when using "localhost" in the ComputerName parameter it works ok, but when I use my IP address instead of localhost, it fails. This happens both on my local host (Windows 8) and on another server (Windows 2008 R2). I checked and winrm service is running and configured:
PS C:\Users\mirit.VENOTION\Desktop> winrm quickconfig
WinRM service is already running on this machine.
WinRM is already set up for remote management on this computer.
invoke-command -ComputerName localhost -FilePath test.ps1 : works well
invoke-command -ComputerName 192.168.0.135 -Credential <username> -UseSSL -FilePath test.ps1:
[192.168.0.98] Connecting to remote server 192.168.0.98 failed with the following error message : The client cannot
connect to the destination specified in the request. Verify that the service on the destination is running and is
accepting requests. Consult the logs and documentation for the WS-Management service running on the destination, most
commonly IIS or WinRM. If the destination is the WinRM service, run the following command on the destination to
analyze and configure the WinRM service: "winrm quickconfig". For more information, see the
about_Remote_Troubleshooting Help topic.
+ CategoryInfo : OpenError: (192.168.0.98:String) , PSRemotingTransportException
+ FullyQualifiedErrorId : CannotConnect,PSSessionStateBroken