Custom Search

Wednesday, September 30, 2009

Find out all the drives including Caption,size from one machine

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery( _ "SELECT * FROM Win32_DiskDrive",,48)
For Each objItem in colItems
msgbox "Caption: " & objItem.Caption
msgbox "DeviceID: " & objItem.DeviceID
msgbox "Partitions: " & objItem.Partitions
msgbox "Size: " & objItem.Size
Next

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.