Remote powershell permissions restricted to machine

20,959

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:
20,959

Related videos on Youtube

WestDiscGolf
Author by

WestDiscGolf

Husband, Dad, Developer and Disc Golfer. I'm also on Twitter

Updated on September 18, 2022

Comments

  • WestDiscGolf
    WestDiscGolf over 1 year

    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?

    • Admin
      Admin almost 11 years
      Can you use Enter-PSSession on that machine?
    • Admin
      Admin almost 11 years
      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.
    • Admin
      Admin almost 11 years
      Remote in and run Enable-PSRemoting -force again; seems like a problem with WinRM to me.
    • Admin
      Admin almost 11 years
      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 :-(
    • Admin
      Admin almost 11 years
      @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.
    • Admin
      Admin almost 11 years
      What happens if you try to run it with FQDN?
    • Admin
      Admin almost 11 years
      @jmreicha trying the same command with the fully qualified domain name I get the same error :-(