In PowerShell, how can I determine if the current drive is a networked drive or not?

Question:

I need to know, from within Powershell, if the current drive is a mapped drive or not.

Unfortunately, Get-PSDrive is not working “as expected”:

but in MS-Dos “net use” shows that H: is really a mapped network drive:

What I want to do is to get the root of the drive and show it in the prompt (see: Customizing PowerShell Prompt – Equivalent to CMD’s $M$P$_$+$G?)

Answer:

Use the .NET framework:

Source:

In PowerShell, how can I determine if the current drive is a networked drive or not? by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply