新 PSDrive --Persist 不起作用 [英] New-PSDrive --Persist doesn't work

查看:32
本文介绍了新 PSDrive --Persist 不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 powershell 在几台计算机上映射一些网络驱动器.大多数情况下它运行良好,但现在它在我以前从未尝试过的计算机上出现故障.

I'm using powershell to map some network drives on a few computers. It's been working fine mostly, but now it's failing on a computer I haven't tried it on before.

我在做

 New-PSDrive -Persist -Name $name -PSProvider FileSystem -Root $path -Scope Global

它成功了.但是我只能在powershell中访问映射驱动器......我在资源管理器中找不到它,我在cmd.exe中也找不到它.在 powershell 中执行 net use 显示它们可以,在 cmd.exe 中执行 net use 显示它们不可用.

And it succeeds. But I can only access the mapped drive in powershell... I can't find it in explorer, and I can't find it in cmd.exe. Doing net use in powershell shows them to be OK, doing net use in cmd.exe shows them to be unavailable.

这在其他计算机上运行良好!

This works fine on other computers though!

所有计算机都运行 Win 7,并且它们具有相同版本的 powershell,3.0.不工作的计算机可能会丢失一些正在工作的计算机上存在的 Windows 更新.我无法将它们连接到 Internet 来安装更新,必须通过刻录的 cd 手动安装它们...

All computers are running Win 7, and they have the same version of powershell, 3.0. The computer that isn't working might be missing some windows updates that are present on the ones that are working. I can't connect them to the internet to install updates, and have to manually install them via burned cds...

推荐答案

映射驱动器是每个用户.

Mapped drives are per user.

如果您的 PowerShell 会话以与登录 Windows 的用户不同的用户身份运行,则您在 PowerShell 会话中映射的任何驱动器都不会显示在 Windows 资源管理器中.

If your PowerShell session is running as a different user than the user logged into Windows, then any drives you map in the PowerShell session will not show up in Windows Explorer.

您需要从以登录 Windows 的同一用户身份运行的 PowerShell 会话映射驱动器.

You need to map the drives from a PowerShell session running as the same user that is logged into Windows.

这篇关于新 PSDrive --Persist 不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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