blumi Posted June 1, 2011 Posted June 1, 2011 Hi, found the following VBS and want to use it to make a littel autoit script to use it. The problem is I have no experience with WMI and autoit. Took a look at some other scripts here but there are still too many questions. It would be great, if someone here can help me with a few lines. Thank you very much Set oLocator = CreateObject("WbemScripting.SWbemLocator") ' --- Checking local WMI WScript.Echo " Connect: root\CIMV2" Set oWMIService = oLocator.ConnectServer("pcname", "root\CIMV2", "", "") WScript.Echo " Query: Select UUID from Win32_ComputerSystemProduct" Set oWmiQuery = oWMIService.ExecQuery("Select UUID from Win32_ComputerSystemProduct") For Each oUuid In oWmiQuery sUuid = oUuid.UUID WScript.Echo "Response: " & sUuid Exit For Next WScript.Echo ""
wakillon Posted June 1, 2011 Posted June 1, 2011 Try $oMyError = ObjEvent("AutoIt.Error","_MyErrFunc") $oLocator = ObjCreate("WbemScripting.SWbemLocator") ; --- Checking local WMI ConsoleWrite ( " Connect: root\CIMV2" & @Crlf ) $oWMIService = $oLocator.ConnectServer("pcname", "root\CIMV2", "", "") ConsoleWrite ( " Query: Select UUID from Win32_ComputerSystemProduct" & @Crlf ) $oWmiQuery = $oWMIService.ExecQuery("Select UUID from Win32_ComputerSystemProduct") For $oUuid In $oWmiQuery $sUuid = $oUuid.UUID ConsoleWrite ( "Response : " & $sUuid & @Crlf ) ExitLoop Next Func _MyErrFunc() $HexNumber=hex($oMyError.number,8) Msgbox(0,"???????? COM Error!", ""& _ "err.description is: " & @TAB & $oMyError.description & @CRLF & _ "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _ "err.number is: " & @TAB & $HexNumber & @CRLF & _ "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _ "err.source is: " & @TAB & $oMyError.source & @CRLF & _ "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $oMyError.helpcontext ) Exit EndFunc AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts
UEZ Posted June 1, 2011 Posted June 1, 2011 (edited) Try this short variant: Global $objItem, $UUID Global $usr = "" Global $pass = "" Global $srv = "localhost" Global $objWMILocator = ObjCreate("WbemScripting.SWbemLocator") Global $objWMIService = $objWMILocator.ConnectServer($srv, "\root\cimv2", $usr, $pass, "", "", "&H80") Global $colItems = $objWMIService.ExecQuery("SELECT UUID FROM Win32_ComputerSystemProduct", "WQL", 0x30) If IsObj($colItems) Then For $objItem In $colItems $UUID = $objItem.UUID Next MsgBox(0, "UUID", $UUID) EndIf Br, UEZ Edited June 1, 2011 by UEZ Gianni 1 Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
blumi Posted June 1, 2011 Author Posted June 1, 2011 Thanks a lot, I have tried the short version and it works fine. Will later check the long version and try to learn a little bit about the code. Thanks for the fast help.
Syed23 Posted June 9, 2011 Posted June 9, 2011 (edited) Hi, I have created on WMI script which will check the Bit locker status of the machine which needs the adminstrator rights... is there a way to check without admin rights? For your reference i have attached the VBS file along with this email. Edited June 9, 2011 by Syed23 Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]
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