Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sources/EventViewerX/SearchEvents.QueryLog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ private static string BuildQueryString(string logName, List<int> eventIds = null

// Add keywords to the query
if (keywords.HasValue) {
AddCondition(queryString, $"Keywords={(long)keywords.Value}");
AddCondition(queryString, $"band(Keywords,{(long)keywords.Value})");
}

// Add level to the query
Expand Down
10 changes: 10 additions & 0 deletions Tests/Get-EVXFilter.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,14 @@ Describe 'Additional Get-WinEventFilter cases' {
$XPath = Get-EVXFilter -ExcludeID 1,2 -LogName 'xx' -XPathOnly
$XPath | Should -Be '*[System[(EventID!=1) or (EventID!=2)]]'
}

It '-Keywords single value should produce band filter' {
$XPath = Get-EVXFilter -Keywords 1125899906842624 -LogName 'xx' -XPathOnly
$XPath | Should -Be '*[System[band(Keywords,1125899906842624)]]'
}

It '-Keywords multiple values should OR them in band filter' {
$XPath = Get-EVXFilter -Keywords 1125899906842624,281474976710656 -LogName 'xx' -XPathOnly
$XPath | Should -Be '*[System[band(Keywords,1407374883553280)]]'
}
}
10 changes: 10 additions & 0 deletions Tests/Get-EVXFilter1.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,14 @@ Describe "Get-EventFilters using Path and NamendDataFilter" {
$XML | Should -BeLike '*Query Id="0" Path="file://*' -Because 'We wanted to query a filepath'
$XML | Should -Not -Belike '*Select Path*' -Because 'Queries using eventfiles do not have a Channel'
}

It '-Keywords single value should produce band filter' {
$XPath = Get-EVXFilter -Keywords 1125899906842624 -LogName 'xx' -XPathOnly
$XPath | Should -Be '*[System[band(Keywords,1125899906842624)]]'
}

It '-Keywords multiple values should OR them in band filter' {
$XPath = Get-EVXFilter -Keywords 1125899906842624,281474976710656 -LogName 'xx' -XPathOnly
$XPath | Should -Be '*[System[band(Keywords,1407374883553280)]]'
}
}
Loading