Jump to content



Photo

Finding a empty drive ie Card Reader


  • Please log in to reply
2 replies to this topic

#1 Chimaera

Chimaera

    Sorry .. Where am i again?

  • Active Members
  • PipPipPipPipPipPip
  • 1,520 posts

Posted 11 May 2012 - 03:12 PM

I was using this for hard drives to get some info

Consolewrite(_HardDrives()) Func _HardDrives() Local $sResult, $objWMIService, $colItems Local $strcomputer = "." $objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & $strcomputer & "\root\cimv2") $colItems = $objWMIService.ExecQuery("Select * from Win32_DiskDrive") For $objItem In $colItems   $sResult &= $objItem.Caption & @TAB & "Size: " & Int($objItem.Size / 1024 ^ 3) & " GB" & @LF Next Return $sResult EndFunc   ;==>_HardDrives


And i noticed that on one machine that had a card reader slot it returned this

Generic-Multi-Card uSB Device Size: 0GB

Is there a way to make it only return that device or maybe only return the 0 GB devices which should be the card reader?





#2 Zedna

Zedna

    AutoIt rulez!

  • MVPs
  • 8,315 posts

Posted 18 May 2012 - 11:57 AM

WMI Classes
http://msdn.microsoft.com/en-us/library/windows/desktop/aa394554%28v=vs.85%29.aspx

Win32 Classes
http://msdn.microsoft.com/en-us/library/windows/desktop/aa394084%28v=vs.85%29.aspx

Win32_DiskDrive
http://msdn.microsoft.com/en-us/library/windows/desktop/aa394132%28v=vs.85%29.aspx

Edited by Zedna, 18 May 2012 - 11:57 AM.


#3 Chimaera

Chimaera

    Sorry .. Where am i again?

  • Active Members
  • PipPipPipPipPipPip
  • 1,520 posts

Posted 27 June 2012 - 02:48 PM

thanks for that
think ive resolved by using
Int($objItem.Capabilities(0)
Will test and report back




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users