PowerShell 2.0:在远程会话期间访问 Windows 共享
我在 PowerShell 远程会话中访问共享网络位置时遇到问题。
从 PowerShell 提示符中,我输入一个新会话:
Enter-PSSession server1
该会话已正确创建并输入。然后,我尝试列出共享的内容:
dir \\server2\share1
响应是以下错误:
Get-ChildItem : Cannot find path '\\server2\share1' because it does not exist.
但是,如果我通过远程桌面进入 server1,启动 PowerShell,并执行完全相同的 dir 命令,则会正确列出内容。
我已经使用凭据尝试了各种方法,但这似乎并不能解决问题。我还通过“whoami”命令确认我在两个示例中具有相同的身份。
什么会导致这种情况呢?
I am having trouble accessing a shared network location while within a PowerShell remote session.
From the PowerShell prompt, I enter a new session:
Enter-PSSession server1
The session is properly created and entered. I then attempt to list the contents of the share:
dir \\server2\share1
The response is this error:
Get-ChildItem : Cannot find path '\\server2\share1' because it does not exist.
However, if I remote desktop into server1, bring up PowerShell, and execute the very same dir command, the contents are correctly listed.
I've tried various things using credentials, but that doesn't seem to fix it. I've also confirmed via the "whoami" command that I have the same identity in both examples.
What would cause this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您无法如上所述使用凭据委托,则可以使用显式凭据在远程会话中挂载(或如下所示进行身份验证)远程共享,例如
此问题与 powershell per 无关-se;您正尝试在远程会话中将本地凭据重播到第三个位置,并且违反了 NTLM“双跳”限制。
If you can't use credential delegation as mentioned above, you can mount (or just authenticate as below) the remote share in the remote session using explicit credentials, e.g.
This problem has nothing to do with powershell per-se; you are trying to replay your local credentials in a remote session to a third location and falling foul of the NTLM "double hop" limitation.
阅读“凭证委托”部分
此处 - 感谢 Keith Hill
并执行这些步骤(如果您尚未执行此操作)。
Read the section "Credential Delegation"
Here - Credit to Keith Hill
and perform the steps if you have not already done so.
另一个选项是 kerberos 资源 委托
例如:
Another option is kerberos resource delegation
eg: