Hellow folks,
I have the following question. I know that WMI lets your retrieve your mapped network drive information if its the local machine. But what I don't understand is how to pull a remote computers mapped network drives. I have seen serveral articles that indicate that you would need to enumerate a remote session as the user, but I have no idea what this means or how to do it. Does anyone know how to use WMI on a remote machine to retrieve the drive mappings?
I have the following question. I know that WMI lets your retrieve your mapped network drive information if its the local machine. But what I don't understand is how to pull a remote computers mapped network drives. I have seen serveral articles that indicate that you would need to enumerate a remote session as the user, but I have no idea what this means or how to do it. Does anyone know how to use WMI on a remote machine to retrieve the drive mappings?
Code:
strComputer = "Remote Machine Name"
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colDrives = objWMIService.ExecQuery _
("Select * From Win32_LogicalDisk Where DriveType = 4")
For Each objDrive In colDrives
strDriveLetter = objDrive.DeviceID
strNetworkPath = objDrive.ProviderName
usql = "INSERT INTO tbl_WMI_NetworkDrive (ComputerName, DriveLetter, DriveMapping) VALUES ('" & strComputerName & "', '" & strDriveLetter & "', '" & strNetworkPath & "')"
CurrentDb.Execute (usql)
Next