首页 > 解决方案 > 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

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

标签: powershellwinrm

解决方案


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


推荐阅读