当我尝试在远程桌面上与用户“Administrator” Build PowerShell会话时,我可以成功 Build 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 回答
显示当前权限 - 它将设置为管理员
编辑:
它会弹出一个标准的Windows权限对话框,您可以在其中添加用户或组 . 我强烈建议使用AD组来控制访问 . 您可以分配权限,如完全控制,读取(获取,枚举,订阅),写入(放置,创建,删除),执行(调用) .
此外,我不得不说,即使我知道这篇文章存在,它花了3秒才谷歌 .
https://blogs.msdn.microsoft.com/powershell/2009/11/22/you-dont-have-to-be-an-administrator-to-run-remote-powershell-commands/