New-PSSession localhost access is denied

This topic contains 4 replies, has 3 voices, and was last updated by Profile photo of Nick Nick 2 months ago.

  • Author
    Posts
  • #70907
    Profile photo of Nick
    Nick
    Participant

    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
    Profile photo of Chris
    Chris
    Participant

    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
    Profile photo of Nick
    Nick
    Participant

    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
    Profile photo of John
    John
    Participant

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

    • #71462
      Profile photo of Nick
      Nick
      Participant

      Hello John,

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

You must be logged in to reply to this topic.