Remote powershell permissions restricted to machine

I am unable to execute powershell scripts on a remote server, but only on my current machine - please help.

Running the following script to give a list of a temp directory on the remote server works from other machines to the same server with my credentials, however doesn't work for any users on my machine.

Invoke-Command -ComputerName <server_name> -Credential (Get-Credential) -ScriptBlock { Get-ChildItem "D:\temp" } 

I receive the following error:

[server_name] Connecting to remote server server_name failed with the following error message : Logon failure: unknown user name or bad password. For more information, see the about_Remote_Troubleshooting Help topic. + CategoryInfo : OpenError: (server_name:String) [], PSRemotingTransportException + FullyQualifiedErrorId : LogonFailure,PSSessionStateBroken

  • Yes, there is a d: drive.
  • Yes, there is a temp directory
  • Yes, my credentials are good - I can remote desktop to the server and can execute the script successfully on other machines.

I am running the powershell 3 - downloaded from http://www.microsoft.com/en-us/download/details.aspx?id=34595 and it's installed successfully.

A call to $PsVersionTable on my laptop gives me this:

Name Value
---- -----

WSManStackVersion 3.0
PSCompatibleVersions {1.0, 2.0, 3.0}
SerializationVersion 1.1.0.1
BuildVersion 6.2.9200.16398
PSVersion 3.0
CLRVersion 4.0.30319.586
PSRemotingProtocolVersion 2.2

I'm running Windows 7 and the server is running Windows 2003. I know powershell 3 doesn't play well with Windows 2003 server, but the command above does execute successfully on other client machines so don't believe this to be an issue.

Any ideas?


So after some further diagnosis tests (logging onto another machine to run it, booting into another OS installation on the same laptop) it came down to the needing to run the following command:

Set-Item WSMan:\localhost\Client\TrustedHosts -value * 

Also while doing further investigation I found this site which could help others with remote powershell issues (posting for reference).