![]() |
Выборка данных из EventLog'a
Захотелось мониторить кто-где заблокировал себе доменную учетку, посему начал раскапывать логи Security вот таким образом:
Код:
Get-WinEvent -FilterHashtable @{LogName=”Security”;ID=4740} -MaxEvents 1 | select * вот так
Message : A user account was locked out.
Subject: Security ID: S-1-5-18 Account Name: DC$ Account Domain: dom Logon ID: 0x3E7 Account That Was Locked Out: Security ID: S-1-5-21-1114597676-1119302421-1926942842-8253 Account Name: username Additional Information: Caller Computer Name: computername Id : 4740 Version : 0 Qualifiers : Level : 0 Task : 13824 Opcode : 0 Keywords : -9214364837600034816 RecordId : 88844217 ProviderName : Microsoft-Windows-Security-Auditing ProviderId : 54849625-5478-4994-a5ba-3e3b0328c30d LogName : Security ProcessId : 608 ThreadId : 5404 MachineName : DC.doma.in UserId : TimeCreated : 01.12.2016 13:30:28 ActivityId : RelatedActivityId : ContainerLog : security MatchedQueryIds : {} Bookmark : System.Diagnostics.Eventing.Reader.EventBookmark LevelDisplayName : Information OpcodeDisplayName : Info TaskDisplayName : User Account Management KeywordsDisplayNames : {Audit Success} Properties : {System.Diagnostics.Eventing.Reader.EventProperty, System.Diagnostics.Eventing.Reader.EventProperty, System.Diagnostics.Eventi ng.Reader.EventProperty, System.Diagnostics.Eventing.Reader.EventProperty...} Как можно получать строку с TimeCreated весьма даже понятно (если просто перечислить их в select), но вот как выдрать нижеприведенные - в упор не догоняю. из Account That Was Locked Out: Account Name: username из Additional Information: Caller Computer Name: computername ткните носом куда копать. |
Свойство Properties или разбирать Message, но первый вариант легче.
|
Kazun, а можно поподробней? Разбирать Message не особо прельщает, а вот про свойства Properties я что-то недопонял.
|
(Get-WinEvent -FilterHashtable @{LogName=”Security”;ID=4740} -MaxEvents 1).Properties
|
Понял, супер. Самое то что нужно.
|
Время: 14:06. |
Время: 14:06.
© OSzone.net 2001-