diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Comments.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Comments.md index d9059c9c1289..a31be4719af9 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Comments.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Comments.md @@ -127,14 +127,14 @@ function Get-Function { } For more information, see: -- [about_Comment_Based_Help][05]. +- [about_Comment_Based_Help][05] - [Writing Comment-Based Help Topics][03] ### `#Requires` The `#Requires` statement prevents a script from running unless the current -PowerShell sessions meets the specified prerequisites. `#Requires` can appear -on any line in a script, but is processed in the same manner regardless of +PowerShell session meets the specified prerequisites. `#Requires` can appear on +any line in a script, but is processed in the same manner regardless of position. ```powershell @@ -171,7 +171,7 @@ sections of code. For PowerShell, the region markers are comments that begin with `#region` and end with `#endregion`. The region markers must be at the beginning of a line. The region markers are supported in the PowerShell ISE and in Visual Studio Code with the PowerShell extension. The region markers aren't -a part of the PowerShell language. PowerShell interprets them as a regular +a part of the PowerShell language. PowerShell interprets them as regular comments. For more information, see the _Folding_ section of the diff --git a/reference/5.1/Microsoft.PowerShell.Utility/Register-EngineEvent.md b/reference/5.1/Microsoft.PowerShell.Utility/Register-EngineEvent.md index 7204b26c0874..97ba04840365 100644 --- a/reference/5.1/Microsoft.PowerShell.Utility/Register-EngineEvent.md +++ b/reference/5.1/Microsoft.PowerShell.Utility/Register-EngineEvent.md @@ -2,7 +2,7 @@ external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Utility -ms.date: 12/12/2022 +ms.date: 01/13/2025 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/register-engineevent?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 title: Register-EngineEvent @@ -16,8 +16,9 @@ Subscribes to events that are generated by the PowerShell engine and by the `New ## SYNTAX ``` -Register-EngineEvent [-SourceIdentifier] [[-Action] ] [-MessageData ] - [-SupportEvent] [-Forward] [-MaxTriggerCount ] [] +Register-EngineEvent [-SourceIdentifier] [[-Action] ] + [-MessageData ] [-SupportEvent] [-Forward] [-MaxTriggerCount ] + [] ``` ## DESCRIPTION @@ -80,7 +81,7 @@ data to a text file. ```powershell Register-EngineEvent -SourceIdentifier MyEventSource -Action { - "Event: {0}" -f $event.messagedata | Out-File c:\temp\MyEvents.txt -Append + "Event: {0}" -f $event.MessageData | Out-File c:\temp\MyEvents.txt -Append } Start-Job -Name TestJob -ScriptBlock { @@ -88,7 +89,11 @@ Start-Job -Name TestJob -ScriptBlock { Register-EngineEvent -SourceIdentifier MyEventSource -Forward Start-Sleep -seconds 2 "Doing some work..." - New-Event -SourceIdentifier MyEventSource -Message ("{0} - Work done..." -f (Get-Date)) + $newEventSplat = @{ + SourceIdentifier = 'MyEventSource' + MessageData = ("{0} - Work done..." -f (Get-Date)) + } + New-Event @newEventSplat } } Start-Sleep -seconds 4 @@ -209,8 +214,8 @@ Accept wildcard characters: False ### -MessageData -Specifies additional data associated with the event. The value of this parameter appears in the -**MessageData** property of the event object. +This parameter is part of the base class for all Event cmdlets. The `Register-EngineEvent` doesn't +use this parameter. Any data passed to this parameter is ignored. ```yaml Type: System.Management.Automation.PSObject diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Comments.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Comments.md index c6ba96e932bc..4c4ff6dba43e 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Comments.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Comments.md @@ -127,14 +127,14 @@ function Get-Function { } For more information, see: -- [about_Comment_Based_Help][05]. +- [about_Comment_Based_Help][05] - [Writing Comment-Based Help Topics][03] ### `#Requires` The `#Requires` statement prevents a script from running unless the current -PowerShell sessions meets the specified prerequisites. `#Requires` can appear -on any line in a script, but is processed in the same manner regardless of +PowerShell session meets the specified prerequisites. `#Requires` can appear on +any line in a script, but is processed in the same manner regardless of position. ```powershell @@ -171,7 +171,7 @@ beginning of a script to indicate which shell should be used to run the script. Shebang isn't a part of the PowerShell language. PowerShell interprets it as a regular comment. Shebang is interpreted by the operating system. -In the following example, the shebang ensures PowerShell run the script when +In the following example, the shebang ensures PowerShell runs the script when the script is invoked from a non-PowerShell context. ```powershell @@ -186,7 +186,7 @@ sections of code. For PowerShell, the region markers are comments that begin with `#region` and end with `#endregion`. The region markers must be at the beginning of a line. The region markers are supported in the PowerShell ISE and in Visual Studio Code with the PowerShell extension. The region markers aren't -a part of the PowerShell language. PowerShell interprets them as a regular +a part of the PowerShell language. PowerShell interprets them as regular comments. For more information, see the _Folding_ section of the diff --git a/reference/7.4/Microsoft.PowerShell.Utility/Register-EngineEvent.md b/reference/7.4/Microsoft.PowerShell.Utility/Register-EngineEvent.md index 749e08c402d7..35b2702c918c 100644 --- a/reference/7.4/Microsoft.PowerShell.Utility/Register-EngineEvent.md +++ b/reference/7.4/Microsoft.PowerShell.Utility/Register-EngineEvent.md @@ -2,7 +2,7 @@ external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Utility -ms.date: 12/12/2022 +ms.date: 01/13/2025 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/register-engineevent?view=powershell-7.4&WT.mc_id=ps-gethelp schema: 2.0.0 title: Register-EngineEvent @@ -16,8 +16,9 @@ Subscribes to events that are generated by the PowerShell engine and by the `New ## SYNTAX ``` -Register-EngineEvent [-SourceIdentifier] [[-Action] ] [-MessageData ] - [-SupportEvent] [-Forward] [-MaxTriggerCount ] [] +Register-EngineEvent [-SourceIdentifier] [[-Action] ] + [-MessageData ] [-SupportEvent] [-Forward] [-MaxTriggerCount ] + [] ``` ## DESCRIPTION @@ -80,7 +81,7 @@ data to a text file. ```powershell Register-EngineEvent -SourceIdentifier MyEventSource -Action { - "Event: {0}" -f $event.messagedata | Out-File c:\temp\MyEvents.txt -Append + "Event: {0}" -f $event.MessageData | Out-File c:\temp\MyEvents.txt -Append } Start-Job -Name TestJob -ScriptBlock { @@ -88,7 +89,11 @@ Start-Job -Name TestJob -ScriptBlock { Register-EngineEvent -SourceIdentifier MyEventSource -Forward Start-Sleep -seconds 2 "Doing some work..." - New-Event -SourceIdentifier MyEventSource -Message ("{0} - Work done..." -f (Get-Date)) + $newEventSplat = @{ + SourceIdentifier = 'MyEventSource' + MessageData = ("{0} - Work done..." -f (Get-Date)) + } + New-Event @newEventSplat } } Start-Sleep -seconds 4 @@ -209,8 +214,8 @@ Accept wildcard characters: False ### -MessageData -Specifies additional data associated with the event. The value of this parameter appears in the -**MessageData** property of the event object. +This parameter is part of the base class for all Event cmdlets. The `Register-EngineEvent` doesn't +use this parameter. Any data passed to this parameter is ignored. ```yaml Type: System.Management.Automation.PSObject diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_Comments.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_Comments.md index 8a7af6f594c4..eb04c4c1a95d 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_Comments.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_Comments.md @@ -127,14 +127,14 @@ function Get-Function { } For more information, see: -- [about_Comment_Based_Help][05]. +- [about_Comment_Based_Help][05] - [Writing Comment-Based Help Topics][03] ### `#Requires` The `#Requires` statement prevents a script from running unless the current -PowerShell sessions meets the specified prerequisites. `#Requires` can appear -on any line in a script, but is processed in the same manner regardless of +PowerShell session meets the specified prerequisites. `#Requires` can appear on +any line in a script, but is processed in the same manner regardless of position. ```powershell @@ -171,7 +171,7 @@ beginning of a script to indicate which shell should be used to run the script. Shebang isn't a part of the PowerShell language. PowerShell interprets it as a regular comment. Shebang is interpreted by the operating system. -In the following example, the shebang ensures PowerShell run the script when +In the following example, the shebang ensures PowerShell runs the script when the script is invoked from a non-PowerShell context. ```powershell @@ -186,7 +186,7 @@ sections of code. For PowerShell, the region markers are comments that begin with `#region` and end with `#endregion`. The region markers must be at the beginning of a line. The region markers are supported in the PowerShell ISE and in Visual Studio Code with the PowerShell extension. The region markers aren't -a part of the PowerShell language. PowerShell interprets them as a regular +a part of the PowerShell language. PowerShell interprets them as regular comments. For more information, see the _Folding_ section of the diff --git a/reference/7.5/Microsoft.PowerShell.Utility/Register-EngineEvent.md b/reference/7.5/Microsoft.PowerShell.Utility/Register-EngineEvent.md index 03a3db54e504..a49ffd86caa7 100644 --- a/reference/7.5/Microsoft.PowerShell.Utility/Register-EngineEvent.md +++ b/reference/7.5/Microsoft.PowerShell.Utility/Register-EngineEvent.md @@ -2,7 +2,7 @@ external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Utility -ms.date: 12/12/2022 +ms.date: 01/13/2025 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/register-engineevent?view=powershell-7.5&WT.mc_id=ps-gethelp schema: 2.0.0 title: Register-EngineEvent @@ -16,8 +16,9 @@ Subscribes to events that are generated by the PowerShell engine and by the `New ## SYNTAX ``` -Register-EngineEvent [-SourceIdentifier] [[-Action] ] [-MessageData ] - [-SupportEvent] [-Forward] [-MaxTriggerCount ] [] +Register-EngineEvent [-SourceIdentifier] [[-Action] ] + [-MessageData ] [-SupportEvent] [-Forward] [-MaxTriggerCount ] + [] ``` ## DESCRIPTION @@ -80,7 +81,7 @@ data to a text file. ```powershell Register-EngineEvent -SourceIdentifier MyEventSource -Action { - "Event: {0}" -f $event.messagedata | Out-File c:\temp\MyEvents.txt -Append + "Event: {0}" -f $event.MessageData | Out-File c:\temp\MyEvents.txt -Append } Start-Job -Name TestJob -ScriptBlock { @@ -88,7 +89,11 @@ Start-Job -Name TestJob -ScriptBlock { Register-EngineEvent -SourceIdentifier MyEventSource -Forward Start-Sleep -seconds 2 "Doing some work..." - New-Event -SourceIdentifier MyEventSource -Message ("{0} - Work done..." -f (Get-Date)) + $newEventSplat = @{ + SourceIdentifier = 'MyEventSource' + MessageData = ("{0} - Work done..." -f (Get-Date)) + } + New-Event @newEventSplat } } Start-Sleep -seconds 4 @@ -209,8 +214,8 @@ Accept wildcard characters: False ### -MessageData -Specifies additional data associated with the event. The value of this parameter appears in the -**MessageData** property of the event object. +This parameter is part of the base class for all Event cmdlets. The `Register-EngineEvent` doesn't +use this parameter. Any data passed to this parameter is ignored. ```yaml Type: System.Management.Automation.PSObject