我需要从这个命令的输出中提取一个特定的数字:
Get-EventLog "application" | Where-Object {$_.EventID -eq 6006}
示例输出为:
Index Time EntryType Source InstanceID Message
----- ---- --------- ------ ---------- -------
18297 May 15 18:49 Warning Wlclntfy 2147489654 The winlogon notification subscriber <Profiles> took 60 second(s) to handle the notification event (Logon).
11788 Jan 31 08:11 Warning Wlclntfy 2147489654 The winlogon notification subscriber <Profiles> took 68 second(s) to handle the notification event (Logon).
5794 Oct 16 09:41 Warning Wlclntfy 2147489654 The winlogon notification subscriber <Sens> took 225 second(s) to handle the notification event (Logoff).
5596 Oct 11 08:03 Warning Wlclntfy 2147489654 The winlogon notification subscriber <Profiles> took 69 second(s) to handle the notification event (Logon).
2719 Aug 30 07:50 Warning Wlclntfy 2147489654 The winlogon notification subscriber <Profiles> took 65 second(s) to handle the notification event (Logon).
我真正需要做的是拉出事件报告的秒数<Profiles>
,并拉出最大的一个。我已经弄清楚(?<=<Profiles> took )(\d+)
是否可以仅提取我需要的数字,但我不确定如何继续实际提取它们。我已经尝试将它传递给 Select-String -pattern,但这根本不返回任何内容。