techthoughts2
6/27/2016 - 5:19 PM

Date manipulation

Date manipulation

$certInfo = ls Cert:\LocalMachine\My | where { $_.Subject -eq $subject }
$expireDate = $certInfo.NotAfter
[int]$daysRemaining = New-TimeSpan -End $expireDate | Select-Object -ExpandProperty Days

$date = Get-Date
$1weekOut = $date.AddDays(7)