DDM 0 Posted July 29, 2011 Hi Can anyone with getting wmi information ? ive tried the following code without success, can't see wants wrong !! Func getsensorinfo() local $strComputer = "localhost" Local $objWMIService Local $colItems,$objItem local $strdisplay $colItems = "" $strdisplay = "" ;$objWMIService = ObjGet("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\hardware") $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\hardware") If IsObj($objWMIService) Then $colItems = $objWMIService.ExecQuery("Select * from NumericSensor") If IsObj($colItems) Then For $objItem In $colItems $strdisplay &= "Sensor" & @CRLF $strdisplay &= @CRLF $strdisplay &= "Caption : " & $objItem.Caption $strdisplay &= @CRLF $strdisplay &= "Name : " & $objItem.CreationClassName $strdisplay &= @CRLF $strdisplay &= "Version : " & $objItem.Description $strdisplay &= @CRLF Next EndIf EndIf MsgBox(4096,"WMI Sensor Object", $strdisplay) EndFunc Share this post Link to post Share on other sites
UEZ 1,273 Posted July 29, 2011 I don't have the namespace root\hardware to test your script but it looks good. Br, UEZ 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Share this post Link to post Share on other sites
water 2,387 Posted July 29, 2011 Please have a look at the This generates all kind of WMI code for AutoIt. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2020-10-10 - Version 1.5.2.1) - Download - General Help & Support - Example Scripts - WikiOutlookEX (NEW 2020-12-15 - Version 1.6.3.1) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2020-06-27 - Version 1.3.2.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - WikiTask Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - WikiTutorials:ADO - Wiki, WebDriver - Wiki Share this post Link to post Share on other sites
Tripredacus 35 Posted July 29, 2011 I don't have the namespace root\hardware to test your script but it looks good. Br, UEZ Nope you have it. You can't connect to that namespace directly. You can access it from CIM_NumericSensor, which DOES exist however an Administrator account can't see it or its values. WMI Tools does not list it if you have the default "Show classes which can have instances" however it does appear if you select "Show all classes" option. Global $sWMIService, $objWMIService, $colItems, $objItem, $oItem Global $xCaption, $xName, $xVersion $sWMIService = "winmgmts:\\" & @ComputerName & "\root\CIMV2" $objWMIService = ObjGet($sWMIService) IF IsObj($objWMIService) Then $colItems = $objWMIService.ExecQuery("SELECT * FROM CIM_NumericSensor") If IsObj($colItems) Then For $oItem In $colItems $xCaption = $oItem.Caption $xName = $oItem.Name ;$xVersion = $oItem.Version Next EndIf MsgBox (4096, "test", "Sensor" & @CRLF & "Caption : " & $xCaption & @CRLF & "Name : " & $xName) EndIF The MsgBox comes up, but the values are blank. WMI Tools reports to me that CIM_NumericSensor: "The selected classes do not have instances." CIM_NumericSensor Class on MSDN Twitter | MSFN | VGCollect Share this post Link to post Share on other sites
UEZ 1,273 Posted July 29, 2011 (edited) With WBEMTEST you can also list WMI namespaces and instances on your system. According to the link you provided it requires the namespace root\hardware with can be found in Ipmiprv.mof which is not installed on my system.Br,UEZ Edited July 29, 2011 by UEZ 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Share this post Link to post Share on other sites