Question:
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.
I’m doing
1 2 |
New-PSDrive -Persist -Name $name -PSProvider FileSystem -Root $path -Scope Global |
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!
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…
Answer:
Mapped drives are per user.
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.
You need to map the drives from a PowerShell session running as the same user that is logged into Windows.