Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot access network drive in PowerShell running as administrator

I'm running PowerShell in a Windows 7 x64 virtual machine. I have a shared folder on the host mapped as a network drive (Z:). When I run PS normally I can access that drive just fine, but if I run it "as administrator" it tells me:

Set-Location : Cannot find drive. A drive with the name 'Z' does not exist. At line:1 char:13 + Set-Location <<<<  Z:     + CategoryInfo          : ObjectNotFound: (Z:String) [Set-Location], DriveNotFoundException     + FullyQualifiedErrorId : DriveNotFound,Microsoft.PowerShell.Commands.SetLocationCommand 

How do I access network drives as administrator?

like image 630
EMP Avatar asked Jan 20 '11 02:01

EMP


1 Answers

In the end the fix was simply to re-map the drive letter while running as Administrator:

net use Z: "\\vmware-host\Shared Folders" 

It doesn't have to be done from the same PowerShell instance (or from PowerShell at all) - it's just something that needs to be done once for the entire logon session.

like image 64
EMP Avatar answered Sep 24 '22 05:09

EMP