powershell - 新 PSDrive --Persist 不起作用

标签 powershell powershell-3.0

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

我正在做

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

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

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

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

最佳答案

映射驱动器是每个用户。

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

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

关于powershell - 新 PSDrive --Persist 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32865461/

相关文章:

Powershell - 奇怪的 WSL 输出字符串编码

powershell - 使用 ref 关键字按引用传递变量

powershell - 如何检测脚本是点源的,还是使用 powershell v2+ 作为模块的一部分加载的?

azure - 连接-MsolService : Authentication Error: Unexpected authentication failure

windows - 将 powershell 输出导出到文本文件

powershell - 在 PowerShell 中将参数传递给 $webclient.DownloadFile()

powershell - 有没有办法知道 Powershell 中的 cmdlet 版本以实现向后兼容?

windows - 如何将 MS .NET Framework 4 添加到 Windows Server 更新服务?

json - 删除 PowerShell JSON 对象的子成员的更好方法是什么

windows - 为什么安装Chocolatey时PowerShell是 "not recognized"?