-2

When I try to establish PowerShell session with the user "Administrator" on remote desktop I can successfully establish the sesssion, but it fails when my user is standarduser or RemoteDesktopUser.

PS C:\WINDOWS\system32> C:\Users\Samantha.dek\Desktop\tru.ps1
New-PSSession : [DESKTOP-SR6UD6M] Connecting to remote server DESKTOP-SR6UD6M
failed with the following error message : Access is denied. For more information,
see the  about_Remote_Troubleshooting Help topic.
At C:\Users\Samantha.Dek\Desktop\tru.ps1:11 char:6
+ $s = New-PSSession -ComputerName $AppServer -Credential $cred
+      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [New-PSSession], PSRemotingTransportException
    + FullyQualifiedErrorId : AccessDenied,PSSessionOpenFailed
Ansgar Wiechers
  • 193,178
  • 25
  • 254
  • 328
Samantha
  • 11
  • 1

1 Answers1

0

Display the current permission - it'll be set to Administrators

Get-PSSessionConfiguration |fl * 

To edit:

Set-PSSessionConfiguration -Name Microsoft.PowerShell -showSecurityDescriptorUI 

It'll pop up a standard-looking Windows permission dialogue, where you can add users or groups. I highly recommend using an AD group to control the access. You can assign rights like Full Control, Read (Get, Enumerate, Subscribe), Write (Put,Create,Delete), Execute (Invoke).

Also, I have to say, it took 3 seconds to google this, even though I knew the article existed.

https://blogs.msdn.microsoft.com/powershell/2009/11/22/you-dont-have-to-be-an-administrator-to-run-remote-powershell-commands/

LeeM
  • 1,118
  • 8
  • 18