@@ -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,14 +556,14 @@ $xmlQuery = @'
556556<QueryList>
557557 <Query Id="0" Path="Windows PowerShell">
558558 <Select Path="System">*[System[(Level=3) and
559- TimeCreated[timediff(@SystemTime) > = 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) > = 86400000]]]'
566+ $XPath = '*[System[Level=3 and TimeCreated[timediff(@SystemTime) < = 86400000]]]'
567567Get-WinEvent -LogName 'Windows PowerShell' -FilterXPath $XPath
568568```
569569
@@ -581,7 +581,7 @@ $Date = (Get-Date).AddDays(-2)
581581Get-WinEvent -FilterHashtable @{ LogName='Application'; StartTime=$Date; Id='1003' }
582582```
583583
584- 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
585585date. The date object is stored in the ` $Date ` variable.
586586
587587The ` Get-WinEvent ` cmdlet gets log information. The ** FilterHashtable** parameter is used to filter
@@ -603,7 +603,7 @@ Get-WinEvent -FilterHashtable @{
603603}
604604```
605605
606- 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
607607current date. The date object is stored in the ` $StartTime ` variable.
608608
609609The ` Get-WinEvent ` cmdlet gets log information. The ** FilterHashtable** parameter is used to filter
@@ -622,8 +622,8 @@ value is the local computer, **localhost**. This parameter accepts only one comp
622622To get event logs from remote computers, configure the firewall port for the event log service to
623623allow remote access.
624624
625- This cmdlet does not rely on PowerShell remoting. You can use the ** ComputerName** parameter even if
626- 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.
627627
628628``` yaml
629629Type : System.String
@@ -677,7 +677,7 @@ Hash table queries have the following rules:
677677- The **Data** value takes event data in an unnamed field. For example, events in classic event
678678 logs.
679679
680- 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
681681name for the event data in the event.
682682
683683The valid `Get-WinEvent` **key/value** pairs are as follows :
@@ -817,7 +817,7 @@ comma-separated list. Wildcards are permitted. You can also pipe log names to th
817817cmdlet.
818818
819819> [!NOTE]
820- > 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
821821> queries the Windows API which has a limit of 256. This can make it difficult to filter through all
822822> of your logs at one time. You can work around this by using a `foreach` loop to iterate through
823823> each log like this: `Get-WinEvent -ListLog * | ForEach-Object{ Get-WinEvent -LogName $_.LogName }`
@@ -898,7 +898,7 @@ Specifies, as a string array, the event log providers from which this cmdlet get
898898provider names in a comma-separated list, or use wildcard characters to create provider name
899899patterns.
900900
901- 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
902902PowerShell provider.
903903
904904` ` ` yaml
@@ -954,7 +954,7 @@ With the **ListProvider** parameter, this cmdlet returns **ProviderMetadata** ob
954954and later versions of Windows. `Get-EventLog` gets events only in classic event logs. `Get-EventLog`
955955is retained for backward compatibility.
956956
957- 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
958958Environment (Windows PE).
959959
960960# # RELATED LINKS
0 commit comments