mardi 1 mai 2018

Powershell Boolean Operators

I am looking to create a Boolean script that alerts when certain certificates are set to expire see the example of spreadsheet.

I was looking at alerts for greater than 90 days out, 89 to 61 days out, 60 days to 31 days out, and less than 30 days out. Alert verbiage is not a big concern right now.

I understand I will need more, but looking to help on this elseif logic. I appreciate the help folks!

$Alert = 'TakeAction'

If ($Alert -gt '90') {

   Write-Host "Licenses or Certificate are fine"

} ElseIf ($Alert -lt '89' -AND -gt'61') {

   Write-Host "Please contact Vendor for updated Licenses or Certificate information"

} ElseIf ($Alert -lt '60' -AND -gt'31') {

   Write-Host "Action must be taken to update Licenses or Certificate from Vendor"

}

} ElseIf ($Alert -lt '30' -AND -gt'1') {

   Write-Host "Immediate action must be taken for renewal of Licenses or Certificate!"

}

Else {

   Write-Host "Certificate Information N/A"

}

Aucun commentaire:

Enregistrer un commentaire