You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
gahujipo edited this page Sep 17, 2019
·
3 revisions
Description
Usage
Before you can log events you need to make sure that the LogName and Source exists. This needs to be done only once (run as an Administrator)
>New-EventLog-LogName <NOTSET>-Source <NOTSET>
You can now log to the EventLog from your script
>Add-LoggingTarget-Name WinEventLog -Configuration @{
LogName=<NOTSET># <Required> Name of the log to which the events are written (eg. 'Application', 'System' and etc.)Source=<NOTSET># <Required> Event source, which is typically the name of the application that is writing the event to the log
}
Write-Log-Level 'WARNING'-Message 'Hello, Powershell!'Write-Log-Level 'WARNING'-Message 'Hello, {0}!'-Arguments 'Powershell'Write-Log-Level 'WARNING'-Message 'Hello, {0}!'-Arguments 'Powershell'-Body @{ EventID=123 }