Reputation: 16236
I need to get the root location of a network mapped drive. Using Get-Location
looks promising.
PS W:\> (Get-Location).Drive
Name Used (GB) Free (GB) Provider Root
---- --------- --------- -------- ----
W 384.97 546.54 FileSystem \\RT-AC66U\files
However, when I reference the Root
member, it gives back the Name
value.
PS W:\> (Get-Location).Drive.Root
W:\
How can I get the Root
value?
Upvotes: 1
Views: 387
Reputation: 1226
A better way of viewing this information, in my opinion, is to run the following in a normal powershell console.. if ran in an elevated console it will return nothing.
Get-WmiObject -Class Win32_MappedLogicalDisk | select Name, ProviderName
That will show all of your mapped drives, including their letters and network locations.
Upvotes: 1