2021/05/20 #イベントログの期間指定フィルタ
皆様おはようございます、
#猫でもできるPowerShell(備忘録)
#イベントログの期間指定フィルタ
$start = "'" + (Get-Date (Get-Date).AddDays(-1)).ToString("s") +".000Z"+ "'"
$end = "'" + (Get-Date).ToString("s") + ".999Z" + "'"
$start
$end
$filter =
'"*[System[TimeCreated[@SystemTime>=' + $start + ' and @SystemTime<=' + $end + ']]]"'
$filter
'2021-05-20T21:53:53.000Z'
'2021-05-21T21:53:53.999Z'
"*[System[TimeCreated[@SystemTime>='2021-05-20T01:53:53.000Z' and @SystemTime<='2021-05-21T01:53:53.999Z']]]"
イベントログの期間指定はやや面倒な書式です
先日調べたカスタム書式と '.000Z'、'.999Z' を使って表現してみました
ではまた;