In PowerShell, how can I determine if the current drive is a networked drive or not?
Use the .NET framework:
PS H:\> $x = new-object system.io.driveinfo("h:\")PS H:\> $x.drivetypeNetwork
Try WMI:
Get-WMI -query "Select ProviderName From Win32_LogicalDisk Where DeviceID='H:'"
An alternative way to use WMI:
get-wmiobject Win32_LogicalDisk | ? {$_.deviceid -eq "s:"} | % {$_.providername}
Get all network drives with:
get-wmiobject Win32_LogicalDisk | ? {$_.drivetype -eq 4} | % {$_.providername}