FreakyMonkey Posted October 15, 2011 Share Posted October 15, 2011 Func getPPVersion($ip) if not Ping($ip,1000) Then return "Offline" EndIf local $strWMI = "winmgmts:{impersonationLevel=Impersonate}!\\" & $ip & "\Root\default:StdRegProv" local $objWMIService = ObjGet($strWMI) if not IsObj($objWMIService) then return "Unknown" local $strKeyPath = "\Software\Tamtron\PowerPath Client\Install Info" local $strKeyValueName = "Version" local $strKeyValue $objWMIService.GetStringValue($HKEY_LOCAL_MACHINE, $strKeyPath, $strKeyValueName, $strKeyValue) if @error Then return "" Else return $strKeyValue EndIf EndFunc I'm getting this error: \\cel-fil-001\profiles$\eleaf\Desktop\GetSLSCWorkstationsDameware.au3 (92) : ==> The requested action with this object has failed.:$objWMIService.GetStringValue($HKEY_LOCAL_MACHINE, $strKeyPath, $strKeyValueName, $strKeyValue)$objWMIService.GetStringValue($HKEY_LOCAL_MACHINE, $strKeyPath, $strKeyValueName, $strKeyValue)^ ERROR Link to comment Share on other sites More sharing options...
JohnOne Posted October 15, 2011 Share Posted October 15, 2011 (edited) Could be way off but tryI'm wrong, dont bother. local $objWMIService = ObjCreate($strWMI) Edited October 15, 2011 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
FreakyMonkey Posted October 15, 2011 Author Share Posted October 15, 2011 LOL ok. but thanks for the reply anyway. Link to comment Share on other sites More sharing options...
UEZ Posted October 15, 2011 Share Posted October 15, 2011 Try this: expandcollapse popupGlobal $oErrorHandler = ObjEvent("AutoIt.Error", "ObjErrorHandler") MsgBox(0, "Test", WMI_GetRegKey(".")) Func WMI_GetRegKey($host) If $host = "." Then $host = @ComputerName Local $ping = Ping($host, 1000) If @error Then Return SetError(1, 0, -1) Local $objReg = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & $host & "\root\default:StdRegProv") If @error Then Return SetError(2, 0, -2) If IsObj($objReg) Then Local $HKLM = 0x80000002 Local $strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\" Local $strKeyValueName = "Shell" Local $strKeyValue $objReg.GetStringValue($HKLM, $strKeyPath, $strKeyValueName, $strKeyValue) Return $strKeyValue Else Return SetError(3, 0, -3) EndIf EndFunc Func ObjErrorHandler() ConsoleWrite( "A COM Error has occured!" & @CRLF & @CRLF & _ "err.description is: " & @TAB & $oErrorHandler.description & @CRLF & _ "err.windescription:" & @TAB & $oErrorHandler & @CRLF & _ "err.number is: " & @TAB & Hex($oErrorHandler.number, 8) & @CRLF & _ "err.lastdllerror is: " & @TAB & $oErrorHandler.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $oErrorHandler.scriptline & @CRLF & _ "err.source is: " & @TAB & $oErrorHandler.source & @CRLF & _ "err.helpfile is: " & @TAB & $oErrorHandler.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $oErrorHandler.helpcontext & @CRLF _ ) EndFunc #cs Func getPPVersion($ip) if not Ping($ip,1000) Then return "Offline" EndIf local $strWMI = "winmgmts:{impersonationLevel=Impersonate}!\\" & $ip & "\Root\default:StdRegProv" local $objWMIService = ObjGet($strWMI) if not IsObj($objWMIService) then return "Unknown" local $strKeyPath = "\Software\Tamtron\PowerPath Client\Install Info" local $strKeyValueName = "Version" local $strKeyValue $objWMIService.GetStringValue($HKEY_LOCAL_MACHINE, $strKeyPath, $strKeyValueName, $strKeyValue) if @error Then return "" Else return $strKeyValue EndIf EndFunc #ce 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
FreakyMonkey Posted October 19, 2011 Author Share Posted October 19, 2011 UEZ, Thanks for the reply. Although your resolution did work, it was due to your constant declaration of HKLM cluing me into the fact I had used the wrong value. I had the VBS value of H80000002 rather than 0x80000002 in my constant. Thanks ^.^ Link to comment Share on other sites More sharing options...
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