例如,如果我想在特定的日期和時間之前檢索eventlog。在Powershell中,如何輸入<datetime>?
Get-EventLog system -Before (what do I enter here?)
從本質上講,輸入日期時間的格式究竟是什麼?
例如,如果我想在特定的日期和時間之前檢索eventlog。在Powershell中,如何輸入<datetime>?
Get-EventLog system -Before (what do I enter here?)
從本質上講,輸入日期時間的格式究竟是什麼?
試試這樣說:
Get-EventLog System -Before "2/22/2017 7:00am"
根據https://msdn.microsoft.com/powershell/reference/4.0/microsoft.powershell.management/Get-EventLog
-Before需要DateTime類型
,你需要使用的文檔。就那麼簡單。
有很多方法可以在PowerShell中滿足這個要求。這裏是可以用於-Before參數,另一個用於 - 後其使用相同類型
$dt = Get-Date
Get-EventLog system -Before $dt -after "2/15/2017 8:27:50 PM" -LogName System
要求之前,請嘗試谷歌的一個例子。 「Powershell日期時間」。第一個結果:https://technet.microsoft.com/en-us/library/ff730960.aspx –
'幫助Get-EventLog -full' –
我沒有把日期放在引號中是原因。抱歉。 – jdsr4c