无法在Powershell远程会话中访问UNC路径 [英] Unable to access UNC Paths in Powershell remote session

查看:94
本文介绍了无法在Powershell远程会话中访问UNC路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法从本地计算机在Powershell远程会话中访问服务器上的UNC路径.我可以直接在Servers Cmd提示符下使用它们.

I am unable to access the UNC paths on my servers in a Powershell remote session from my local machine. I am able to use them from Servers Cmd prompt directly.

实际上,我已经登录到服务器并将UNC路径映射为本地驱动器(例如X :).使用登录时重新连接"选项.

Actually, I have logged into the server and mapped a UNC path as local drive (say X:). Used Reconnect on Login option.

我有一个批处理文件驻留在此X:驱动器中,我想使用本地脚本中的invoke命令远程运行它.但是,它失败了.

I have a batch file which resides in this X: drive, I want to run it remotely using invoke command from my local script. But, it fails.

显示找不到驱动器.名称为X的驱动器不存在."

It says "Cannot find drive. A drive with name X doesn't exist".

此外,当我尝试在脚本块中使用net use命令映射驱动器时,也会引发错误-系统错误1223-本机命令错误.

Also, when I try to map drive using net use command in the scriptblock then also it throws an error - System error 1223 - Native Command Error.

我使用管理员凭据登录到该服务器.

I use administrator credentials to log into this server.

有人可以帮我吗,我要做的就是远程运行位于此UNC路径上的脚本?

Can anyone please help me on this, all i want to do is to run the script remotely which resides on this UNC path ?

此外,当我在服务器中将UNC路径映射为本地驱动器时,为什么不能在PS远程会话中使用它?

Also, when I map a UNC Path in the server as a local drive, why am I unable to use it in a PS remote session ?

在此先感谢. TS

推荐答案

您这里确实发生了3种不同的事情.

You've really got 3 different things going on here.

1& 3.仅当您以交互方式登录时,才会映射驱动器.因此,当您远程访问另一台计算机,映射驱动器,然后注销/断开连接时,该映射的驱动器已断开连接.除了在交互式GUI用户会话中,您不能依靠自己创建的映射驱动器号.在脚本或任何远程会话中,只需对所有内容使用UNC路径-更为可靠.

1 & 3. Drives are only mapped when you log on interactively. So when you remoted into the other computer, mapped a drive, and then logged off/disconnected, that mapped drive was disconnected. Except in interactive GUI user sessions, you cannot depend upon a mapped drive letter that you don't create yourself. Within scripts or any remote session, just use UNC paths for everything - it's more reliable.

2.当您尝试在远程PS会话中映射驱动器时,遇到了所谓的双跳"问题.有一个解决方案,但是您需要做一些额外的设置.请参阅对没有CredSSP的文件进行双跳访问

2 . When you attempt to map the drive in the remote PS session, you're encountering what's known as the "double hop" problem. There is a solution to this, but there's extra setup you have to do. See Double hop access to copy files without CredSSP

这篇关于无法在Powershell远程会话中访问UNC路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆