Get Events
The following example gets the event log events that match the criteria.
- Connect to the administration web service.
- Get the default event log filter criteria, and configure if required.
Code Sample
# Gets the events that match the specified criteria.
$criteria = $administration.GET_DefaultEventLogCriteria();
# Optionally configure the required criteria.
$criteria.Username = "*Administrator*";
$criteria.MaximumResultCount = 100;
# Get the event log entries, and optional attributes.
$entries = $administration.GET_EventLogEntries($criteria);
foreach ($entry in $entries.Event)
{
Write-Host "------------- Entry -------------";
Write-Host $entry.CreationDate;
Write-Host $entry.EntryCodeString;
Write-Host $entry.Message;
Write-Host $entry.EntryCode;
foreach ($attribute in $entry.Attributes.Attribute)
{
Write-Host "$($attribute.InformationTypeDisplayName): $($attribute.Value)";
}
}