I'm trying to write a script that will read the SCEP definition date from registry, compare it to the current time, and if it's older than 2 days run an action. In my code below, it always returns "Old". What am I missing?
$data = Get-ItemProperty "HKLM:\Software\Microsoft\Windows
Defender\Signature Updates" | Select-Object -ExpandProperty
AVSignatureApplied
$time = [DateTime]::FromFileTime( (((((($data[7]*256 + $data[6])*256 +
$data[5])*256 + $data[4])*256 + $data[3])*256 + $data[2])*256 +
$data[1])*256 + $data[0])
$datdate = Get-Date $time
Write-Host $datdate
if ((Get-Date) - $datdate -gt 2) {
Write-Host "Old"
}else {
Write-Host "New"
}
Best Regards,
Mike Murray
Desktop Engineer/IT Consultant - IT Support Services
California State University, Chico
530.898.4357
<mailto:[email protected]> [email protected]
Remember, Chico State will NEVER ask you for your password via email!
For more information about recognizing phishing scam emails go to:
<http://www.csuchico.edu/isec/basics/spam-and-phishing.shtml>
http://www.csuchico.edu/isec/basics/spam-and-phishing.shtml
smime.p7s
Description: S/MIME cryptographic signature

