By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,188 Members | 834 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,188 IT Pros & Developers. It's quick & easy.

WMI Remotely Scan Network Drives

maxamis4
Expert 100+
P: 295
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?


Expand|Select|Wrap|Line Numbers
  1. strComputer = "Remote Machine Name"
  2.  
  3. Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
  4.  
  5.  
  6.  
  7. Set colDrives = objWMIService.ExecQuery _
  8. ("Select * From Win32_LogicalDisk Where DriveType = 4")
  9.  
  10.    For Each objDrive In colDrives
  11.  
  12.        strDriveLetter = objDrive.DeviceID
  13.         strNetworkPath = objDrive.ProviderName
  14.  
  15.       usql = "INSERT INTO tbl_WMI_NetworkDrive (ComputerName, DriveLetter, DriveMapping) VALUES ('" & strComputerName & "', '" & strDriveLetter & "', '" & strNetworkPath & "')"
  16.          CurrentDb.Execute (usql)
  17.    Next
  18.  
  19.  
  20.  
Apr 9 '08 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.