Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
    
Can you use Enter-PSSession on that machine? –  Tanner May 30 '13 at 15:49
    
Running Enter-PSSession pointing to the server I get "WinRM cannot process the request.the following error occured while using Kerberos authentication: Cannot find the computer <server_name> ... " but it is available. –  WestDiscGolf May 30 '13 at 15:56
    
Remote in and run Enable-PSRemoting -force again; seems like a problem with WinRM to me. –  Tanner May 30 '13 at 15:58
    
I've tried that (and just again) but no luck. I can run the command on another machine into the same server though so I'm still thinking it's on the client side ... some how :-( –  WestDiscGolf May 30 '13 at 16:01
    
@WestDiscGolf - I would reimage the client if thats possible. Sounds like a client configuration without more knowlege it will be hard for us to solve. –  Ramhound May 30 '13 at 16:03

2 Answers 2

up vote 2 down vote accepted

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).

share|improve this answer

I'm assuming your using PowerShell v2.0 in your Windows Server 2003 and that you enabled WINRM 2.0 on the server too. PowerShell v3.0 WINRM should connect to Window Server 2003 in that case.

Make sure you run the Enable-PSRemoting on the server as describe by the "WestDiscGolf" notes. Also, you need to check your firewall rules in your Windows 7 client just to make sure.

Give it another try. :)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.