微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

New-PsSession 使用本地帐户失败

如何解决New-PsSession 使用本地帐户失败

我通过 RDP 连接到一台工作组计算机,并尝试与域上的远程服务器建立 PowerShell 远程会话。

当我尝试使用其本地管理员帐户之一连接到远程服务器时,出现以下错误

new-pssession : [IP] 连接到远程服务器 IP 失败 以下错误消息:访问被拒绝。了解更多信息, 请参阅 about_Remote_Troubleshooting 帮助主题

当我使用域管理员帐户运行连接时,连接工作正常。

$domainCred = Get-Credential
$localCred = Get-Credential

PS C:\Users\ss_synadmin> New-PSSession -ComputerName IP -Credential $localCred
New-PSSession : [IP] Connecting to Remote Server IP 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 <IP> -Credential $localcred
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [New-PSSession],PSRemotin
   gTransportException
    + FullyQualifiedErrorId : AccessDenied,PSSessionopenFailed
PS C:\Users\ss_synadmin> New-PSSession -ComputerName <IP> -Credential $domainCred

 Id Name            ComputerName    State         ConfigurationName     Availability
 -- ----            ------------    -----         -----------------     ------------
 16 Session16       IP    Opened        Microsoft.PowerShell     Available

既然两个帐户都是管理员,那有什么好处?

解决方法

天啊,它是 LocalAccountTokenFilterPolicy 注册表项 (https://docs.microsoft.com/en-us/windows-server/manage/windows-admin-center/support/troubleshooting#using-windows-admin-center-in-a-workgroup)。我在工作组服务器上检查过,而不是在域服务器上。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。