Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
- #AutoIt3Wrapper_Change2CUI=y
- #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
- #include <Array.au3>
- dim $USB_DeviceID
- dim $USB_DriveLetter
- dim $USB_Partition
- $WMIObj = ObjGet("winmgmts:\\" & @ComputerName & "\root\cimv2")
- If @error Then
- MsgBox(0, "Error", "Error getting wmi : " & Hex(@error, 8))
- Else
- $DiskObjItems = $WMIObj.ExecQuery("select * from win32_diskdrive where InterfaceType='USB'")
- If IsObj($DiskObjItems) Then
- For $oItem In $DiskObjItems
- ConsoleWrite($oItem.Index & ": " & $oItem.Caption & " - " & $oItem.InterfaceType & " - " & $oItem.DeviceID & @CRLF)
- $USB_DeviceID = $oItem.DeviceID
- Next
- EndIf
- $PartitionsObjects = $WMIObj.ExecQuery("associators of {Win32_DiskDrive.DeviceID='" & $USB_DeviceID & "'} where AssocClass = Win32_DiskDriveToDiskPartition")
- If IsObj($PartitionsObjects) Then
- For $oItem In $PartitionsObjects
- ;~ MsgBox(0, "test", "test")
- $USB_Partition = $oItem.DeviceID
- ConsoleWrite($oItem.DeviceID & @CRLF)
- Next
- EndIf
- $VolumesObjects = $WMIObj.ExecQuery("associators of {Win32_DiskPartition.DeviceID='" & $USB_Partition & "'} where AssocClass = Win32_LogicalDiskToPartition")
- If IsObj($VolumesObjects) Then
- For $oItem In $VolumesObjects
- ;~ MsgBox(0, "test", "test")
- $USB_DriveLetter = $oItem.DeviceID
- ConsoleWrite($oItem.DeviceID & @CRLF)
- Next
- EndIf
- EndIf
Add Comment
Please, Sign In to add comment