New-PSSession localhost access is denied

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</blockquote>
    
    

Apparently, this problem appears on machines running Windows 10.

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

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.

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

Hello John,

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