New-PSSession localhost access is denied

Welcome Forums General PowerShell Q&A New-PSSession localhost access is denied

This topic contains 4 replies, has 3 voices, and was last updated by

 
Participant
1 year, 5 months ago.

  • Author
    Posts
  • #70907

    Participant
    Points: 0
    Rank: Member

    Hi everyone,

    I'm trying to create a new PS Session to localhost just to try it. However I have a problem already at this step.

    Yep, I'm obviously using admin account. Any idea what it could be?

    PS C:\WINDOWS\system32> New-PSSession -ComputerName localhost

    New-PSSession : [localhost] Connecting to remote server localhost failed with the following error message : Access is denied. For more information, see the
    about_Remote_Troubleshooting Help topic.
    At line:1 char:1
    + New-PSSession -ComputerName localhost
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [New-PSSession], PSRemotingTransportException
    + FullyQualifiedErrorId : AccessDenied,PSSessionOpenFailed

    Apparently, this problem appears on machines running Windows 10.

  • #70909

    Participant
    Points: 0
    Rank: Member

    It could be to do with credentials, try using Get-Credential, sign in and see if it gives you an error?

    $C = Get-Credential
    
    New-PSSession -ComputerName localhost -Credential $C
  • #70937

    Participant
    Points: 0
    Rank: Member

    Chris, thanks for your answer. I'm sorry I forgot to mention, credentials don't change anything. The same script works fine on Windows 7, but not 10.

  • #71458

    Participant
    Points: 0
    Rank: Member

    I had the same issue. You have to go to all the Win10 machines and enable-psremoting. Our course as an Admin.

    • #71462

      Participant
      Points: 0
      Rank: Member

      Hello John,

      Yes, I enable PS remoting beforehand. So it doesn't solve the issue.

The topic ‘New-PSSession localhost access is denied’ is closed to new replies.