@@ -78,7 +78,7 @@ selected event providers. And, you can combine events from multiple sources in a
7878` Get-WinEvent ` allows you to filter events using XPath queries, structured XML queries, and hash
7979table queries.
8080
81- If you're not running PowerShell as an Administrator, you might see error messages that you cannot
81+ If you're not running PowerShell as an Administrator, you might see error messages that you can't
8282retrieve information about a log.
8383
8484## EXAMPLES
160160 $log.SaveChanges()
161161 Get-WinEvent -ListLog Security | Format-List -Property *
162162}catch [System.UnauthorizedAccessException]{
163- $ErrMsg = 'You do not have permission to configure this log!'
163+ $ErrMsg = 'You don't have permission to configure this log!'
164164 $ErrMsg += ' Try running this script with administrator privileges. '
165165 $ErrMsg += $_.Exception.Message
166166 Write-Error $ErrMsg
@@ -445,7 +445,7 @@ other properties from the output. The grouped objects are sent down the pipeline
445445### Example 12: Get events from an archived event log
446446
447447` Get-WinEvent ` can get event information from saved log files. This sample uses an archived
448- PowerShell log that is stored on the local computer.
448+ PowerShell log that's stored on the local computer.
449449
450450``` powershell
451451Get-WinEvent -Path 'C:\Test\Windows PowerShell.evtx'
@@ -470,7 +470,7 @@ the directory and file name.
470470
471471These commands get a specific number of events from an archived event log. ` Get-WinEvent ` has
472472parameters that can get a maximum number of events or the oldest events. This sample uses an
473- archived PowerShell log that is stored in ** C:\Test\PowerShellCore Operational.evtx** .
473+ archived PowerShell log that's stored in ** C:\Test\PowerShellCore Operational.evtx** .
474474
475475``` powershell
476476Get-WinEvent -Path 'C:\Test\PowerShellCore Operational.evtx' -MaxEvents 100
@@ -498,7 +498,7 @@ from newest to oldest.
498498
499499Event Tracing for Windows (ETW) writes events to the log as events occur. The events are stored in
500500the order of oldest to newest. An archived ETW file is saved as an ` .etl ` such as ** TraceLog.etl** .
501- The events are listed in the order in which they are written to the log, so the * Oldest* parameter
501+ The events are listed in the order in which they're written to the log, so the * Oldest* parameter
502502is required.
503503
504504``` powershell
@@ -509,7 +509,7 @@ Get-WinEvent -Path 'C:\Tracing\TraceLog.etl' -Oldest |
509509
510510The ` Get-WinEvent ` cmdlet gets log information from the archived file. The ** Path** parameter
511511specifies the directory and file name. The ** Oldest** parameter is used to output events in the
512- order they are written, oldest to newest. The objects are sent down the pipeline to the
512+ order they're written, oldest to newest. The objects are sent down the pipeline to the
513513` Sort-Object ` cmdlet ` Sort-Object ` sorts the objects in descending order by the value of the
514514** TimeCreated** property. The objects are sent down the pipeline to the ` Select-Object ` cmdlet that
515515displays the 100 newest events.
@@ -519,7 +519,7 @@ displays the 100 newest events.
519519This example shows how to get the events from an event trace log file (` .etl ` ) and an archived
520520Windows PowerShell log file (` .evtx ` ). You can combine multiple file types in a single command.
521521Because the files contain the same type of ** .NET Framework** object, ** EventLogRecord** , you can
522- filter them with the same properties. The command requires the ** Oldest** parameter because it is
522+ filter them with the same properties. The command requires the ** Oldest** parameter because it's
523523reading from an ` .etl ` file, but the ** Oldest** parameter applies to each file.
524524
525525``` powershell
@@ -529,7 +529,7 @@ Get-WinEvent -Path 'C:\Tracing\TraceLog.etl', 'C:\Test\Windows PowerShell.evtx'
529529
530530The ` Get-WinEvent ` cmdlet gets log information from the archived files. The ** Path** parameter uses
531531a comma-separated list to specify each files directory and file name. The ** Oldest** parameter is
532- used to output events in the order they are written, oldest to newest. The objects are sent down the
532+ used to output events in the order they're written, oldest to newest. The objects are sent down the
533533pipeline to the ` Where-Object ` cmdlet. ` Where-Object ` uses a script block to find events with an
534534** Id** of ** 403** . The ` $_ ` variable represents the current object in the pipeline and ** Id** is the
535535Event Id property.
@@ -556,30 +556,32 @@ $xmlQuery = @'
556556<QueryList>
557557 <Query Id="0" Path="Windows PowerShell">
558558 <Select Path="System">*[System[(Level=3) and
559- TimeCreated[timediff(@SystemTime) &lt; = 86400000]]]</Select>
559+ TimeCreated[timediff(@SystemTime) < = 86400000]]]</Select>
560560 </Query>
561561</QueryList>
562562'@
563563Get-WinEvent -FilterXML $xmlQuery
564564
565565# Using the FilterXPath parameter:
566- $XPath = '*[System[Level=3 and TimeCreated[timediff(@SystemTime) &lt; = 86400000]]]'
566+ $XPath = '*[System[Level=3 and TimeCreated[timediff(@SystemTime) < = 86400000]]]'
567567Get-WinEvent -LogName 'Windows PowerShell' -FilterXPath $XPath
568568```
569569
570570### Example 17: Use FilterHashtable to get events from the Application log
571571
572572This example uses the ** FilterHashtable** parameter to get events from the ** Application** log. The
573573hash table uses ** key/value** pairs. For more information about the ** FilterHashtable** parameter,
574- see [ Creating Get-WinEvent queries with FilterHashtable] ( /powershell/scripting/samples/Creating-Get-WinEvent-queries-with-FilterHashtable ) .
575- For more information about hash tables, see [ about_Hash_Tables] ( ../Microsoft.PowerShell.Core/about/about_hash_tables.md ) .
574+ see
575+ [ Creating Get-WinEvent queries with FilterHashtable] ( /powershell/scripting/samples/Creating-Get-WinEvent-queries-with-FilterHashtable ) .
576+ For more information about hash tables, see
577+ [ about_Hash_Tables] ( ../Microsoft.PowerShell.Core/about/about_hash_tables.md ) .
576578
577579``` powershell
578580$Date = (Get-Date).AddDays(-2)
579581Get-WinEvent -FilterHashtable @{ LogName='Application'; StartTime=$Date; Id='1003' }
580582```
581583
582- The ` Get-Date ` cmdlet uses the ** AddDays** method to get a date that is two days before the current
584+ The ` Get-Date ` cmdlet uses the ** AddDays** method to get a date that's two days before the current
583585date. The date object is stored in the ` $Date ` variable.
584586
585587The ` Get-WinEvent ` cmdlet gets log information. The ** FilterHashtable** parameter is used to filter
@@ -601,7 +603,7 @@ Get-WinEvent -FilterHashtable @{
601603}
602604```
603605
604- The ` Get-Date ` cmdlet uses the ** AddDays** method to get a date that is seven days before the
606+ The ` Get-Date ` cmdlet uses the ** AddDays** method to get a date that's seven days before the
605607current date. The date object is stored in the ` $StartTime ` variable.
606608
607609The ` Get-WinEvent ` cmdlet gets log information. The ** FilterHashtable** parameter is used to filter
@@ -620,8 +622,8 @@ value is the local computer, **localhost**. This parameter accepts only one comp
620622To get event logs from remote computers, configure the firewall port for the event log service to
621623allow remote access.
622624
623- This cmdlet does not rely on PowerShell remoting. You can use the ** ComputerName** parameter even if
624- your computer is not configured to run remote commands.
625+ This cmdlet doesn't rely on PowerShell remoting. You can use the ** ComputerName** parameter even if
626+ your computer isn't configured to run remote commands.
625627
626628``` yaml
627629Type : System.String
@@ -675,7 +677,7 @@ Hash table queries have the following rules:
675677- The **Data** value takes event data in an unnamed field. For example, events in classic event
676678 logs.
677679
678- When `Get-WinEvent` cannot interpret a **key/value** pair, it interprets the key as a case-sensitive
680+ When `Get-WinEvent` can't interpret a **key/value** pair, it interprets the key as a case-sensitive
679681name for the event data in the event.
680682
681683The valid `Get-WinEvent` **key/value** pairs are as follows :
@@ -715,8 +717,9 @@ Help.
715717
716718Use an XML query to create a complex query that contains several XPath statements. The XML format
717719also allows you to use a **Suppress XML** element that excludes events from the query. For more
718- information about the XML schema for event log queries, see [Query Schema](/windows/win32/wes/queryschema-schema)
719- and the XML Event Queries section of [Event Selection](/previous-versions/aa385231(v=vs.85)).
720+ information about the XML schema for event log queries, see
721+ [Query Schema](/windows/win32/wes/queryschema-schema) and the XML Event Queries section of
722+ [Event Selection](/previous-versions/aa385231(v=vs.85)).
720723
721724` ` ` yaml
722725Type: System.Xml.XmlDocument
@@ -734,8 +737,9 @@ Accept wildcard characters: False
734737
735738Specifies an XPath query that this cmdlet select events from one or more logs.
736739
737- For more information about the XPath language, see [XPath Reference](/previous-versions/dotnet/netframework-4.0/ms256115(v=vs.100))
738- and the Selection Filters section of [Event Selection](/previous-versions/aa385231(v=vs.85)).
740+ For more information about the XPath language, see
741+ [XPath Reference](/previous-versions/dotnet/netframework-4.0/ms256115(v=vs.100)) and the
742+ _Selection Filters_ section of [Event Selection](/previous-versions/aa385231(v=vs.85)).
739743
740744` ` ` yaml
741745Type: System.String
@@ -813,10 +817,10 @@ comma-separated list. Wildcards are permitted. You can also pipe log names to th
813817cmdlet.
814818
815819> [!NOTE]
816- > PowerShell does not limit the amount of logs you can request. However, the `Get-WinEvent` cmdlet
820+ > PowerShell doesn't limit the amount of logs you can request. However, the `Get-WinEvent` cmdlet
817821> queries the Windows API which has a limit of 256. This can make it difficult to filter through all
818- > of your logs at one time. You can work around this by using a `foreach` loop to iterate through each
819- > log like this: `Get-WinEvent -ListLog * | ForEach-Object{ Get-WinEvent -LogName $_.LogName }`
822+ > of your logs at one time. You can work around this by using a `foreach` loop to iterate through
823+ > each log like this: `Get-WinEvent -ListLog * | ForEach-Object{ Get-WinEvent -LogName $_.LogName }`
820824
821825` ` ` yaml
822826Type: System.String[]
@@ -894,7 +898,7 @@ Specifies, as a string array, the event log providers from which this cmdlet get
894898provider names in a comma-separated list, or use wildcard characters to create provider name
895899patterns.
896900
897- An event log provider is a program or service that writes events to the event log. It is not a
901+ An event log provider is a program or service that writes events to the event log. It isn't a
898902PowerShell provider.
899903
900904` ` ` yaml
@@ -913,7 +917,8 @@ Accept wildcard characters: True
913917
914918This cmdlet supports the common parameters : -Debug, -ErrorAction, -ErrorVariable,
915919-InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose,
916- -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).
920+ -WarningAction, and -WarningVariable. For more information, see
921+ [about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).
917922
918923# # INPUTS
919924
@@ -949,7 +954,7 @@ With the **ListProvider** parameter, this cmdlet returns **ProviderMetadata** ob
949954and later versions of Windows. `Get-EventLog` gets events only in classic event logs. `Get-EventLog`
950955is retained for backward compatibility.
951956
952- The `Get-WinEvent` and `Get-EventLog` cmdlets are not supported in Windows Pre-installation
957+ The `Get-WinEvent` and `Get-EventLog` cmdlets aren't supported in Windows Pre-installation
953958Environment (Windows PE).
954959
955960# # RELATED LINKS
0 commit comments