@@ -151,9 +151,9 @@ with the asterisk (`*`) wildcard to display each property.
151151
152152### Example 3: Configure the classic Security log
153153
154- This command gets an ** EventLogConfiguration** object that represents the classic ** Security** log.
155- The object is then used to configure settings for the log, such as max file size, file path, and
156- whether the log is enabled.
154+ This command gets an ** EventLogConfiguration** object that represents the classic ** Security** log. The
155+ object is then used to configure settings for the log, such as max file size, file path, and whether the
156+ log is enabled.
157157
158158``` powershell
159159$log = Get-WinEvent -ListLog Security
@@ -196,18 +196,17 @@ ProviderLatency : 1000
196196ProviderControlGuid :
197197```
198198
199- The ` Get-WinEvent ` cmdlet uses the ** ListLog** parameter to specify the ** Security** log. The object
200- is saved to a variable. The ** MaximumSizeInBytes** property is set to 1 gigabyte on the object. The
199+ The ` Get-WinEvent ` cmdlet uses the ** ListLog** parameter to specify the ** Security** log. The object is
200+ saved to a variable. The ** MaximumSizeInBytes** property is set to 1 gigabyte on the object. The
201201** SaveChanges** method is called to push the change to the system inside of a try block to handle
202- access violations. The ` Get-WinEvent ` cmdlet is called again on the ** Security** log and piped to
203- the ` Format-List ` cmdlet to verify that the ** MaximumSizeInBytes** property has been saved on the
204- machine.
202+ access violations. The ` Get-WinEvent ` cmdlet is called again on the ** Security** log and piped to the
203+ ` Format-List ` cmdlet to verify that the ** MaximumSizeInBytes** property has been saved on the machine.
205204
206205### Example 4: Get event logs from a server
207206
208207This command only gets event logs on the local computer that contain events. It's possible for a
209208log's ** RecordCount** to be null or zero. The example uses the ` $_ ` variable. For more information,
210- see [ about_Automatic_Variables] ( ../Microsoft.PowerShell.Core/About/about_Automatic_Variables .md ) .
209+ see [ about_Automatic_Variables] ( ../Microsoft.PowerShell.Core/about/about_automatic_variables .md ) .
211210
212211``` powershell
213212Get-WinEvent -ListLog * -ComputerName localhost | Where-Object { $_.RecordCount }
@@ -234,8 +233,7 @@ is a property of the object with a non-null value.
234233
235234This example gets objects that represent the ** Application** event logs on three computers:
236235Server01, Server02, and Server03. The ` foreach ` keyword is used because the ** ComputerName**
237- parameter accepts only one value. For more information, see
238- [ about_Foreach] ( ../Microsoft.PowerShell.Core/About/about_Foreach.md ) .
236+ parameter accepts only one value. For more information, see [ about_Foreach] ( ../Microsoft.PowerShell.Core/about/about_Foreach.md ) .
239237
240238``` powershell
241239$S = 'Server01', 'Server02', 'Server03'
@@ -347,8 +345,7 @@ This command lists the Event Ids that the **Microsoft-Windows-GroupPolicy** even
347345along with the event description.
348346
349347``` powershell
350- (Get-WinEvent -ListProvider Microsoft-Windows-GroupPolicy).Events |
351- Format-Table Id, Description
348+ (Get-WinEvent -ListProvider Microsoft-Windows-GroupPolicy).Events | Format-Table Id, Description
352349```
353350
354351``` Output
@@ -508,7 +505,7 @@ is required.
508505
509506``` powershell
510507Get-WinEvent -Path 'C:\Tracing\TraceLog.etl' -Oldest |
511- Sort-Object -Property TimeCreated -Descending |
508+ Sort-Object -Property TimeCreated -Descending |
512509 Select-Object -First 100
513510```
514511
@@ -529,7 +526,7 @@ reading from an `.etl` file, but the **Oldest** parameter applies to each file.
529526
530527``` powershell
531528Get-WinEvent -Path 'C:\Tracing\TraceLog.etl', 'C:\Test\Windows PowerShell.evtx' -Oldest |
532- Where-Object { $_.Id -eq '403' }
529+ Where-Object { $_.Id -eq '403' }
533530```
534531
535532The ` Get-WinEvent ` cmdlet gets log information from the archived files. The ** Path** parameter uses
@@ -561,24 +558,25 @@ $xmlQuery = @'
561558<QueryList>
562559 <Query Id="0" Path="Windows PowerShell">
563560 <Select Path="System">*[System[(Level=3) and
564- TimeCreated[timediff(@SystemTime) &lt; = 86400000]]]</Select>
561+ TimeCreated[timediff(@SystemTime) > = 86400000]]]</Select>
565562 </Query>
566563</QueryList>
567564'@
568565Get-WinEvent -FilterXML $xmlQuery
569566
570567# Using the FilterXPath parameter:
571- $XPath = '*[System[Level=3 and TimeCreated[timediff(@SystemTime) &lt; = 86400000]]]'
568+ $XPath = '*[System[Level=3 and TimeCreated[timediff(@SystemTime) > = 86400000]]]'
572569Get-WinEvent -LogName 'Windows PowerShell' -FilterXPath $XPath
573570```
574571
575572### Example 17: Use FilterHashtable to get events from the Application log
576573
577574This example uses the ** FilterHashtable** parameter to get events from the ** Application** log. The
578575hash table uses ** key/value** pairs. For more information about the ** FilterHashtable** parameter,
579- see [ Creating Get-WinEvent queries with FilterHashtable] ( /powershell/scripting/samples/creating-get-winevent-queries-with-filterhashtable ) .
576+ see
577+ [ Creating Get-WinEvent queries with FilterHashtable] ( /powershell/scripting/samples/Creating-Get-WinEvent-queries-with-FilterHashtable ) .
580578For more information about hash tables, see
581- [ about_Hash_Tables] ( ../Microsoft.PowerShell.Core/About/about_Hash_Tables .md ) .
579+ [ about_Hash_Tables] ( ../Microsoft.PowerShell.Core/about/about_hash_tables .md ) .
582580
583581``` powershell
584582$Date = (Get-Date).AddDays(-2)
@@ -600,7 +598,7 @@ that occurred within the last week.
600598``` powershell
601599$StartTime = (Get-Date).AddDays(-7)
602600Get-WinEvent -FilterHashtable @{
603- LogName ='Application'
601+ Logname ='Application'
604602 ProviderName='Application Error'
605603 Data='iexplore.exe'
606604 StartTime=$StartTime
@@ -766,8 +764,8 @@ Accept wildcard characters: False
766764Specifies an XPath query that this cmdlet select events from one or more logs.
767765
768766For more information about the XPath language, see
769- [XPath Reference](/previous-versions/dotnet/netframework-4.0/ms256115(v=vs.100))
770- and the Selection Filters section of [Event Selection](/previous-versions/aa385231(v=vs.85)).
767+ [XPath Reference](/previous-versions/dotnet/netframework-4.0/ms256115(v=vs.100)) and the
768+ _Selection Filters_ section of [Event Selection](/previous-versions/aa385231(v=vs.85)).
771769
772770` ` ` yaml
773771Type: System.String
@@ -987,13 +985,13 @@ Environment (Windows PE).
987985
988986# # RELATED LINKS
989987
990- [about_Automatic_Variables](../Microsoft.PowerShell.Core/About/about_Automatic_Variables .md)
988+ [about_Automatic_Variables](../Microsoft.PowerShell.Core/about/about_automatic_variables .md)
991989
992- [about_Foreach](../Microsoft.PowerShell.Core/About /about_Foreach.md)
990+ [about_Foreach](../Microsoft.PowerShell.Core/about /about_Foreach.md)
993991
994- [about_Hash_Tables](../Microsoft.PowerShell.Core/About/about_Hash_Tables .md)
992+ [about_Hash_Tables](../Microsoft.PowerShell.Core/about/about_hash_tables .md)
995993
996- [Creating Get-WinEvent queries with FilterHashtable](/powershell/scripting/samples/creating-get-winevent -queries-with-filterhashtable )
994+ [Creating Get-WinEvent queries with FilterHashtable](/powershell/scripting/samples/Creating-Get-WinEvent -queries-with-FilterHashtable )
997995
998996[Format-Table](../Microsoft.PowerShell.Utility/Format-Table.md)
999997
0 commit comments