Powershell New-SmbMapping drives only accessible from Powershell [closed]

给你一囗甜甜゛ 提交于 2019-12-20 03:54:34

问题


As I understand it, New-SmbMapping W: -RemotePath \\myserver\myfolder should do the same thing as net use w: \\myserver\myfolder. However, if I use net I am easily able to access the mapped drive from the Windows Explorer. On the other hand, if I use New-SmbMapping, it shows up if I run Get-SmbMapping, and I can access it with the start W: command, but it doesn't show up in My Computer and if I type W: into the Windows Explorer bar Windows complains about being unable to find the file location. What's wrong here?


回答1:


I'm not familiar with New-SmbMaping but in PowerShell 3.0 you can use the New-PSdrive and the -Persist switch to map a drive. Remoce the psdrive to disconnect from the mapped network drive.

New-PSDrive -Name W -Root \\myserver\myfolder -Persist -PSProvider FileSystem


来源:https://stackoverflow.com/questions/17032879/powershell-new-smbmapping-drives-only-accessible-from-powershell

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!