How to list mapped drives on remote computers?

Wondering how to list all the mapped drives of remote users?

There are two way I can think of that can do this.

1. Is to write a script that loop through the registry keys on the user’s profile for mapped drives.

2. Is to use the “psexec” tool and remotely execute commands.

For solution number 1, here is a nice script for it that we found from the web (link)

For solution number 2, here is the vbs script code looks like.

strComputer = “machinename”
Set objWMIService = GetObject(“winmgmts:\\” & strComputer & “\root\cimv2″)
Set colDrives = objWMIService.ExecQuery _
(“Select * From Win32_LogicalDisk Where DriveType = 4″)
For Each objDrive in colDrives
Wscript.Echo “Drive letter: ” & objDrive.DeviceID
Wscript.Echo “Network path: ” & objDrive.ProviderName