通过powershell操作eventlog
relevant command list
~\Desktop> (Get-Command Write-EventLog).Parameters Key Value --- ----- WarningAction System.Management.Automation.ParameterMetadata RawData System.Management.Automation.ParameterMetadata Verbose System.Management.Automation.ParameterMetadata WarningVariable System.Management.Automation.ParameterMetadata ErrorAction System.Management.Automation.ParameterMetadata Category System.Management.Automation.ParameterMetadata InformationAction System.Management.Automation.ParameterMetadata ErrorVariable System.Management.Automation.ParameterMetadata Source System.Management.Automation.ParameterMetadata PipelineVariable System.Management.Automation.ParameterMetadata EventId System.Management.Automation.ParameterMetadata OutVariable System.Management.Automation.ParameterMetadata Debug System.Management.Automation.ParameterMetadata InformationVariable System.Management.Automation.ParameterMetadata ComputerName System.Management.Automation.ParameterMetadata EntryType System.Management.Automation.ParameterMetadata Message System.Management.Automation.ParameterMetadata LogName System.Management.Automation.ParameterMetadata OutBuffer System.Management.Automation.ParameterMetadata AsJob System.Management.Automation.ParameterMetadata
Write-EventLog
Write-EventLog -Source "SupperSocketService" -LogName "TestLog" -Message "test on 20180928" -EventId 3001
New-EventLog
This command was used to create a new source
New-EventLog -Source "SupperSocketService" -LogName "TestLog" -MessageResourceFile "C:\Test\TestApp.dll"
Remove-EventLog
Remove-EventLog -LogName "TestLog"
Get-EventLog
Get-EventLog -List
Max(K) Retain OverflowAction Entries Log ------ ------ -------------- ------- --- 51,200 0 OverwriteAsNeeded 4,852 Application 512 7 OverwriteOlder 0 Dell 20,480 0 OverwriteAsNeeded 0 HardwareEvents 512 7 OverwriteOlder 0 Internet Explorer 512 7 OverwriteOlder 722 isaAgentLog 10,240 0 OverwriteAsNeeded 21,192 Kaspersky Event Log 20,480 0 OverwriteAsNeeded 0 Key Management Service 512 7 OverwriteOlder 8 Lisa 128 0 OverwriteAsNeeded 179 OAlerts 512 7 OverwriteOlder 0 PreEmptive 8,192 0 OverwriteAsNeeded 2,692 Red Gate Software 51,200 0 OverwriteAsNeeded 24,441 Security 512 7 OverwriteOlder 1 SupperSocketService 51,200 0 OverwriteAsNeeded 20,441 System 20,480 7 OverwriteOlder 1,460 VisualSVNServer 20,480 7 OverwriteOlder 0 VisualSVNServerActivity 20,480 7 OverwriteOlder 490 VisualSVNServerBackgroundJobs 20,480 -1 DoNotOverwrite 0 VisualSVNServerManagement 20,480 7 OverwriteOlder 0 VisualSVNServerReplication 512 7 OverwriteOlder 0 Windows Azure 15,360 0 OverwriteAsNeeded 12,678 Windows PowerShell