John Bartow
jbartow at winhaven.net
Thu Apr 24 20:08:30 CDT 2014
Hi all, Any ideas as to why this doesn't work? If I replace: "$remaining = $xml.RegistrationConfig.DaysRemaining " With $remaining = 272 Then it works correctly. Otherwise it works inversely in regards to the -gt operator. Code ------------------------------------------------- # Display Vipre license expiration date # Runs on Windows 7 Try { $xml = [xml](get-content C:\ProgramData\VIPRE\RegistrationConfig.xml) #C:\Programdata\GFI Software\Antimalware\RegistrationConfig.xml $remaining = $xml.RegistrationConfig.DaysRemaining #days until expiration - currently evaluates to 272 $expires = $xml.RegistrationConfig.ExpireDate #date of expiration If ($remaining -gt 45) { Write-Host "Vipre License expires in" $remaining "days on" "{0:dd/MM/yyyy}" -f [datetime]$expires Write-Host "Successfully passed" exit 0 } else { Write-Host "Vipre License expires in" $remaining "days on" "{0:dd/MM/yyyy}" -f [datetime]$expires Write-Host "Vipre License is Expiring Soon!" exit 1001 } } Catch { Write-Host "Failure" exit 1001 } End Code ------------------------------------------------- TIA John B