在远程桌面上为非管理员用户建立PowerShell会话

时间:2017-10-25 06:48:32

标签: powershell powershell-remoting

当我尝试在远程桌面上与用户“Administrator”建立PowerShell会话时,我可以成功建立sesssion,但是当我的用户是standarduser或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

1 个答案:

答案 0 :(得分:0)

显示当前权限 - 它将设置为管理员

Get-PSSessionConfiguration |fl * 

编辑:

Set-PSSessionConfiguration -Name Microsoft.PowerShell -showSecurityDescriptorUI 

它会弹出一个标准的Windows权限对话框,您可以在其中添加用户或组。我强烈建议使用AD组来控制访问。您可以分配权限,如完全控制,读取(获取,枚举,订阅),写入(放置,创建,删除),执行(调用)。

另外,我不得不说,即使我知道这篇文章存在,也需要3秒才能使用谷歌。

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

相关问题