Belini Posted October 6, 2013 Posted October 6, 2013 I need to know which USB devices are plugged into the PC and save it in a file. Ini, which command does this? My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ
mrflibblehat Posted October 6, 2013 Posted October 6, 2013 (edited) Something like this. $vFile = FileOpen("usb.txt", 2) Local $vObjWMI = ObjGet("winmgmts:\\" & @ComputerName & "\root\cimv2") $vObjItems = $vObjWMI.ExecQuery('SELECT * FROM Win32_USBHub') If IsObj($vObjItems) Then For $vObjItem In $vObjItems FileWriteLine($vFile, $vObjItem.Description & @CRLF) FileWriteLine($vFile, $vObjItem.DeviceID & @CRLF & @CRLF) Next EndIf FileClose($vFile) ShellExecute("usb.txt") or if your specifically looking for USB Drives. maybe the below. $vFile = FileOpen("usb.txt", 2) Local $vObjWMI = ObjGet("winmgmts:\\" & @ComputerName & "\root\cimv2") $vObjItems = $vObjWMI.ExecQuery('SELECT * FROM Win32_DiskDrive') If IsObj($vObjItems) Then For $vObjItem In $vObjItems If StringInStr($vObjItem.Caption, "USB") Then FileWriteLine($vFile, $vObjItem.Caption & @CRLF) FileWriteLine($vFile, $vObjItem.DeviceID & @CRLF & @CRLF) EndIf Next EndIf FileClose($vFile) ShellExecute("usb.txt") Edited October 6, 2013 by mrflibblehat Alexxander 1 [font="'courier new', courier, monospace;"]Pastebin UDF | Prowl UDF[/font]
AZJIO Posted October 6, 2013 Posted October 6, 2013 DriveGet... "Removable" Chuckero 1 My other projects or all
Belini Posted October 7, 2013 Author Posted October 7, 2013 (edited) I do not want to find drivers but human interface devices like keyboard, mouse and USB joystick. Edited October 7, 2013 by Belini My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ
mrflibblehat Posted October 7, 2013 Posted October 7, 2013 (edited) Have a look at >this post. Or have a look at the below. $vFile = FileOpen("usb.txt", 2) Local $vObjWMI = ObjGet("winmgmts:\\" & @ComputerName & "\root\cimv2") $vObjItems = $vObjWMI.ExecQuery('SELECT * FROM Win32_PnPEntity') If IsObj($vObjItems) Then For $vObjItem In $vObjItems If StringInStr($vObjItem.PNPDeviceID, "HID\") Then FileWriteLine($vFile, $vObjItem.Name & @CRLF) FileWriteLine($vFile, $vObjItem.DeviceID & @CRLF & @CRLF) EndIf Next EndIf FileClose($vFile) ShellExecute("usb.txt") Edited October 7, 2013 by mrflibblehat [font="'courier new', courier, monospace;"]Pastebin UDF | Prowl UDF[/font]
Belini Posted October 7, 2013 Author Posted October 7, 2013 (edited) @mrflibblehat i tried everything that was posted there and could not identify the devices connected human interface on the PC, and the code you posted does not report that the device is connected. Edited: This program shows http://www.nirsoft.net/utils/usb_devices_view.html more with Autoit not know how to do. Edited October 7, 2013 by Belini My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now