问题
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