Win32_LogicalDisk doesn't retrieve network drives from remote machines

I'd like to use WMI to retrieve all logical disks from a remote host. For some unknown reason, running get-wmiobject Win32_LogicalDisk -computername remoteHost fails to include network drives located on the remote Windows host. However, running get-wmiobject Win32_LogicalDisk locally on remoteHost successfully retrieves all logical disks, network drives included.

For example, running the command locally retrieves all logical disks (output formatted for clarity):

>get-wmiobject Win32_LogicalDisk

DeviceID     : A:
DriveType    : 2

DeviceID     : C:
DriveType    : 3

DeviceID     : D:
DriveType    : 5

DeviceID     : S:   // this is a network drive
DriveType    : 4
ProviderName : \\path\Share

However, running the same command remotely fails to retrieve network drive S:

>get-wmiobject Win32_LogicalDisk -computername remoteHost -credential DOMAIN\Admin

DeviceID     : A:
DriveType    : 2

DeviceID     : C:
DriveType    : 3

DeviceID     : D:
DriveType    : 5

The same happens if I use WinRM. The remote host is running Win Server 2012 R2. The result is the same no matter what OS I run the command on (Win7, Win Server 2008 R2, Win Server 2012 R2).

Any ideas what may be causing the network drive(s) to be omitted from the result set?


Turns out using Win32_MappedLogicalDisk will specifically retrieve network drives even from remote hosts.

Disclaimer: I don't guarantee that this solution is the best (or even accurate) way to resolve this problem, nor do I know if there are any additional considerations involved; it merely solves my specific problem.


As far as I have researched, there are 2 places Windows stores networks drives (Map drives, if you exclude PS-drives).

  • One is WMI, as mentioned here, you can get this information in WMI Win32_MappedLogicalDisk class.

  • Two is registry, under HKEY_Current_User:\Network All the keys here, is network letters and map drive information.

An ex. on a key is:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Network\x]
"RemotePath"="\\\\Server1\\ShareName"
"UserName"=dword:00000000
"ProviderName"="Microsoft Windows Network"
"ProviderType"=dword:00020000
"ConnectionType"=dword:00000001
"DeferFlags"=dword:00000004

Powershell Code

To the get the Mapdrive information:Get-ItemProperty -Path "HKCU:\Network\*"

You can not get this information in your logon user context. This information is stored in another users context and that is not accessible to you. I cannot go any further in to this here, as this is a LARGE topic in Powershell or for that matter .Net.

To get this information from the Registry and WMI, you will need to run the code in the users context. You can get the Credential for the user, you can create a GPO, that runs in the logged on users context or you can use System Center to run the code in the "Log on users" context.

Hope this is useful information. It took some time for me to learn and dig up.