EventLog Class | MSBuild Extension Pack Help 4.0.12.0 |
Valid TaskActions are:
Backup (Required: LogName, BackupPath Optional: MachineName)
CheckExists (Required: LogName Optional: MachineName Output: Exists)
Clear (Required: LogName Optional: MachineName)
Create (Required: LogName Optional: MaxSize, Retention, MachineName, CategoryCount, MessageResourceFile, CategoryResourceFile, ParameterResourceFile)
Delete (Required: LogName Optional: MachineName)
Modify (Required: LogName Optional: MaxSize, Retention, MachineName)
Remote Execution Support: Yes
Inheritance Hierarchy
MSBuild.ExtensionPackBaseTask
MSBuild.ExtensionPack.ComputerEventLog
Namespace: MSBuild.ExtensionPack.Computer
Assembly: MSBuild.ExtensionPack (in MSBuild.ExtensionPack.dll) Version: 4.0.0.0
The EventLog type exposes the following members.
Constructors
Name | Description | |
---|---|---|
EventLog |
Properties
Name | Description | |
---|---|---|
BackupPath |
Sets the Backup Path
| |
CategoryCount |
Sets the number of categories in the category resource file
| |
CategoryResourceFile |
Sets the path of the category resource file to write events with localized category strings
| |
Exists |
Gets a value indicating whether the event log exists.
| |
LogName |
Sets the name of the Event Log
| |
MaxSize |
Sets the size of the max.
| |
MessageResourceFile |
Sets the path of the message resource file to configure an event log source to write localized event messages
| |
ParameterResourceFile |
Sets the path of the parameter resource file to configure an event log source to write localized event messages with inserted parameter strings
| |
Retention |
Sets the retention. Any value > 0 is interpreted as days to retain. Use -1 for 'Overwrite as needed'. Use -2 for 'Never Overwrite'
|
Examples
<Project ToolsVersion="4.0" DefaultTargets="Default" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <TPath>$(MSBuildProjectDirectory)\..\MSBuild.ExtensionPack.tasks</TPath> <TPath Condition="Exists('$(MSBuildProjectDirectory)\..\..\Common\MSBuild.ExtensionPack.tasks')">$(MSBuildProjectDirectory)\..\..\Common\MSBuild.ExtensionPack.tasks</TPath> </PropertyGroup> <Import Project="$(TPath)"/> <Target Name="Default"> <!-- Backup an eventlog --> <MSBuild.ExtensionPack.Computer.EventLog TaskAction="Backup" LogName="Security" BackupPath="C:\Securitybackup.evt"/> <!-- Delete an eventlog --> <MSBuild.ExtensionPack.Computer.EventLog TaskAction="Delete" LogName="DemoEventLog"/> <!-- Check whether an eventlog exists --> <MSBuild.ExtensionPack.Computer.EventLog TaskAction="CheckExists" LogName="DemoEventLog"> <Output TaskParameter="Exists" PropertyName="DoesExist"/> </MSBuild.ExtensionPack.Computer.EventLog> <Message Text="DemoEventLog Exists: $(DoesExist)"/> <!-- Create whether an eventlog --> <MSBuild.ExtensionPack.Computer.EventLog TaskAction="Create" LogName="DemoEventLog" MaxSize="20" Retention="14"/> <MSBuild.ExtensionPack.Computer.EventLog TaskAction="CheckExists" LogName="DemoEventLog"> <Output TaskParameter="Exists" PropertyName="DoesExist"/> </MSBuild.ExtensionPack.Computer.EventLog> <Message Text="DemoEventLog Exists: $(DoesExist)"/> <!-- Various other quick tasks --> <MSBuild.ExtensionPack.Computer.EventLog TaskAction="Clear" LogName="DemoEventLog"/> <MSBuild.ExtensionPack.Computer.EventLog TaskAction="Modify" LogName="DemoEventLog" MaxSize="55" Retention="25"/> <MSBuild.ExtensionPack.Computer.EventLog TaskAction="Delete" LogName="DemoEventLog"/> <MSBuild.ExtensionPack.Computer.EventLog TaskAction="CheckExists" LogName="DemoEventLog"> <Output TaskParameter="Exists" PropertyName="DoesExist"/> </MSBuild.ExtensionPack.Computer.EventLog> <Message Text="Exists: $(DoesExist)"/> </Target> </Project>
See Also