Sunday, April 29, 2018

windows 8 - Powershell remoting as non-administrator


I'm using ssh to log on to other Windows machines. I'm trying to make a pssession on a localhost. But I cannot do it in normal posh prompt:


$ New-PSSession
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
+ ~~~~~~~~~~~~~
+ CategoryInfo : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspa
ce) [New-PSSession], PSRemotingTransportException
+ FullyQualifiedErrorId : AccessDenied,PSSessionOpenFailed

It seems that I have to be on an elevated posh shell. Is there any way to do this without administrator privileges?


Answer



Powershell Remoting has a default PSSessionConfiguration called Microsoft.PowerShell with a SDDL which only allows people with administrative rights to execute remote commands on that machine.


You will need to get in touch with an administrator and have them open that up for you:


PS C:\> Set-PSSessionConfiguration -Name Microsoft.PowerShell -showSecurityDescriptorUI

More info here: http://blogs.msdn.com/b/powershell/archive/2009/11/23/you-don-t-have-to-be-an-administrator-to-run-remote-powershell-commands.aspx


Don't forget to Enable-PSRemoting along with opening the appropriate ports (5985 HTTP/5986 HTTPS).


No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...