powershell - 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
既然两个帐户都是管理员,那有什么用呢?
解决方案
Drat,这是 LocalAccountTokenFilterPolicy 注册表项(https://docs.microsoft.com/en-us/windows-server/manage/windows-admin-center/support/troubleshooting#using-windows-admin-center-in-a -工作组)。我在工作组服务器上检查过它,而不是在域服务器上。
推荐阅读
- php - 无法在 AWS Elastic Beanstalk 实例中部署新版本
- python - 没有 multiprocessing.cpu_count?
- google-analytics - 在谷歌分析中,为什么我在 abc.com 帐户下看到 xyz.com 页面访问?
- java - 为什么我的登录表单与空密码字段连接?
- file-upload - 如何在 Nativescript Vue 中上传文件
- c++ - 我可以从`std::array`派生一个类吗?
- ember.js - Visual Studio 代码中的 Eslint 不能使用 .hbs 文件?
- c++ - 迭代 std::tuple 的简单方法是什么?
- ruby - 为什么在Ruby中下载大文件后内存泄漏?
- php - 两个时无法提交我的表单