norry Posted July 9, 2008 Share Posted July 9, 2008 Currently I have the followingDim $strcomputer = "." Dim $objWMIService = ObjGet("winmgmts:" & "{impersonationLevel=impersonate}!\\" & $strcomputer & "\root\cimv2") Dim $colSettings = $objWMIService.ExecQuery ("SELECT * FROM SoftwareLicensingProduct") For $objComputer in $colSettings $LicenseStatus = $objComputer.LicenseStatus $EvaluationendDate = _WMIDateStringToDate($objComputer.EvaluationendDate) $GracePeriodRemaining = $objComputer.GracePeriodRemaining NextSee http://msdn.microsoft.com/en-us/library/cc534596(VS.85).aspx for SoftwareLicensingProduct ClassIgnore the fact that it's missing _WMIDateStringToDate for now the important part that I'm stuck on is the value returned for GracePeriodRemaining.I know that what is currently held on the PC in WMI for GracePeriodRemaining is the following.03594000000What is being returned in the code above for GracePeriodRemaining is 0.Is this because the query is only returning the first row?How to I access different rows? I've had a read on the beginners WMI thread but can't see what I'm after.Any pointers would be greatly received. Link to comment Share on other sites More sharing options...
norry Posted July 9, 2008 Author Share Posted July 9, 2008 Ok using Scriptomatic I've now got $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $colItems = "" $strComputer = "localhost" $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM SoftwareLicensingProduct", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly) $Output = "" For $objItem In $colItems $Output = $objItem.GracePeriodRemaining If $Output <> 0 then ExitLoop Next Msgbox(48,"WMI Output",$Output) This now returns 35940 which is the value I was after. 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