ScriptUSER Posted April 6, 2007 Posted April 6, 2007 Is this Vbs script converatble to autoit script ? the script Returns information about the signed plug and play drivers installed on a computer. strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colItems = objWMIService.ExecQuery("Select * from Win32_PnPSignedDriver") For Each objItem in colItems Wscript.Echo "Class Guid: " & objItem.ClassGuid Wscript.Echo "Compatability ID: " & objItem.CompatID Wscript.Echo "Description: " & objItem.Description Wscript.Echo "Device Class: " & objItem.DeviceClass Wscript.Echo "Device ID: " & objItem.DeviceID Wscript.Echo "Device Name: " & objItem.DeviceName dtmWMIDate = objItem.DriverDate strReturn = WMIDateStringToDate(dtmWMIDate) Wscript.Echo "Driver Date: " & strReturn Wscript.Echo "Driver Provider Name: " & objItem.DriverProviderName Wscript.Echo "Driver Version: " & objItem.DriverVersion Wscript.Echo "Hardware ID: " & objItem.HardWareID Wscript.Echo "INF Name: " & objItem.InfName Wscript.Echo "Is Signed: " & objItem.IsSigned Wscript.Echo "Manufacturer: " & objItem.Manufacturer Wscript.Echo "PDO: " & objItem.PDO Wscript.Echo "Signer: " & objItem.Signer Wscript.Echo Next Function WMIDateStringToDate(dtmWMIDate) If Not IsNull(dtmWMIDate) Then WMIDateStringToDate = CDate(Mid(dtmWMIDate, 5, 2) & "/" & _ Mid(dtmWMIDate, 7, 2) & "/" & Left(dtmWMIDate, 4) _ & " " & Mid (dtmWMIDate, 9, 2) & ":" & _ Mid(dtmWMIDate, 11, 2) & ":" & Mid(dtmWMIDate,13, 2)) End If End Function
Uten Posted April 7, 2007 Posted April 7, 2007 Probably. Take a look at this and see how similar they are. Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling
ScriptUSER Posted April 8, 2007 Author Posted April 8, 2007 Probably. Take a look at this and see how similar they are. I am getting trouble with Converting the vbs function to autoit , which is Function WMIDateStringToDate(dtmWMIDate) If Not IsNull(dtmWMIDate) Then WMIDateStringToDate = CDate(Mid(dtmWMIDate, 5, 2) & "/" & _ Mid(dtmWMIDate, 7, 2) & "/" & Left(dtmWMIDate, 4) _ & " " & Mid (dtmWMIDate, 9, 2) & ":" & _ Mid(dtmWMIDate, 11, 2) & ":" & Mid(dtmWMIDate,13, 2)) End If End Function
PsaltyDS Posted August 3, 2007 Posted August 3, 2007 I had to do this for one of my own scripts, and translated it thusly, listing all PnP drivers: expandcollapse popup$sFile = @ScriptDir & "\DriverList.txt" $hFile = FileOpen($sFile, 2) ; 2 = overwrite $oCimV2 = ObjGet("WinMgmts:\\" & @ComputerName & "\root\CimV2") If IsObj($oCimV2) Then $sQuery = "Select * From Win32_PnPSignedDriver" $colDrivers = $oCimV2.ExecQuery ($sQuery) If IsObj($colDrivers) Then $n = 0 For $oDriver In $colDrivers $sMsg = "Driver " & $n & ": " $sMsg &= @CRLF & @TAB & "Class Guid: " & $oDriver.ClassGuid $sMsg &= @CRLF & @TAB & "Compatability ID: " & $oDriver.CompatID $sMsg &= @CRLF & @TAB & "Description: " & $oDriver.Description $sMsg &= @CRLF & @TAB & "Device Class: " & $oDriver.DeviceClass $sMsg &= @CRLF & @TAB & "Device ID: " & $oDriver.DeviceID $sMsg &= @CRLF & @TAB & "Device Name: " & $oDriver.DeviceName $sMsg &= @CRLF & @TAB & "Driver Provider Name: " & $oDriver.DriverProviderName $sMsg &= @CRLF & @TAB & "Driver Version: " & $oDriver.DriverVersion $sWMIDate = $oDriver.DriverDate $sWMIDate = _WMIDateStringToDate($sWMIDate) $sMsg &= @CRLF & @TAB & "Driver Date: " & $sWMIDate $sMsg &= @CRLF & @TAB & "HardWare ID: " & $oDriver.HardWareID $sMsg &= @CRLF & @TAB & "Inf Name: " & $oDriver.InfName $sMsg &= @CRLF & @TAB & "Is Signed: " & $oDriver.IsSigned $sMsg &= @CRLF & @TAB & "Manufacturer: " & $oDriver.Manufacturer $sMsg &= @CRLF & @TAB & "PDO: " & $oDriver.PDO $sMsg &= @CRLF & @TAB & "Signer: " & $oDriver.Signer FileWrite($hFile, $sMsg & @CRLF & @CRLF) $n += 1 Next Else ConsoleWrite("Debug: $colDrivers is not an object." & @LF) EndIf Else ConsoleWrite("Debug: $oCimV2 is not an object." & @LF) EndIf FileClose($hFile) Run("notepad.exe " & $sFile) Func _WMIDateStringToDate($dtmWMIDate) If StringLen($dtmWMIDate) >= 15 Then Local $RET = StringMid($dtmWMIDate, 5, 2) & "/" & StringMid($dtmWMIDate, 7, 2) & "/" & StringLeft($dtmWMIDate, 4) & " " & _ StringMid($dtmWMIDate, 9, 2) & ":" & StringMid($dtmWMIDate, 11, 2) & ":" & StringMid($dtmWMIDate, 13, 2) Return $RET Else Return 0 EndIf EndFunc ;==>_WMIDateStringToDate I didn't try to translate the VB CDate() function, because the date string generated looks right to me (being all numeric, language is not an issue). Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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