Skip to content

Commit

Permalink
Fix description of MessageData parameter (#11663)
Browse files Browse the repository at this point in the history
  • Loading branch information
sdwheeler authored Jan 13, 2025
1 parent 2c2c2fb commit 8dba7f0
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 21 deletions.
19 changes: 12 additions & 7 deletions reference/5.1/Microsoft.PowerShell.Utility/Register-EngineEvent.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -16,8 +16,9 @@ Subscribes to events that are generated by the PowerShell engine and by the `New
## SYNTAX

```
Register-EngineEvent [-SourceIdentifier] <String> [[-Action] <ScriptBlock>] [-MessageData <PSObject>]
[-SupportEvent] [-Forward] [-MaxTriggerCount <Int32>] [<CommonParameters>]
Register-EngineEvent [-SourceIdentifier] <String> [[-Action] <ScriptBlock>]
[-MessageData <PSObject>] [-SupportEvent] [-Forward] [-MaxTriggerCount <Int32>]
[<CommonParameters>]
```

## DESCRIPTION
Expand Down Expand Up @@ -80,15 +81,19 @@ 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 {
While ($True) {
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
Expand Down Expand Up @@ -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
Expand Down
19 changes: 12 additions & 7 deletions reference/7.4/Microsoft.PowerShell.Utility/Register-EngineEvent.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -16,8 +16,9 @@ Subscribes to events that are generated by the PowerShell engine and by the `New
## SYNTAX

```
Register-EngineEvent [-SourceIdentifier] <String> [[-Action] <ScriptBlock>] [-MessageData <PSObject>]
[-SupportEvent] [-Forward] [-MaxTriggerCount <Int32>] [<CommonParameters>]
Register-EngineEvent [-SourceIdentifier] <String> [[-Action] <ScriptBlock>]
[-MessageData <PSObject>] [-SupportEvent] [-Forward] [-MaxTriggerCount <Int32>]
[<CommonParameters>]
```

## DESCRIPTION
Expand Down Expand Up @@ -80,15 +81,19 @@ 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 {
While ($True) {
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
Expand Down Expand Up @@ -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
Expand Down
19 changes: 12 additions & 7 deletions reference/7.5/Microsoft.PowerShell.Utility/Register-EngineEvent.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -16,8 +16,9 @@ Subscribes to events that are generated by the PowerShell engine and by the `New
## SYNTAX

```
Register-EngineEvent [-SourceIdentifier] <String> [[-Action] <ScriptBlock>] [-MessageData <PSObject>]
[-SupportEvent] [-Forward] [-MaxTriggerCount <Int32>] [<CommonParameters>]
Register-EngineEvent [-SourceIdentifier] <String> [[-Action] <ScriptBlock>]
[-MessageData <PSObject>] [-SupportEvent] [-Forward] [-MaxTriggerCount <Int32>]
[<CommonParameters>]
```

## DESCRIPTION
Expand Down Expand Up @@ -80,15 +81,19 @@ 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 {
While ($True) {
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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 8dba7f0

Please sign in to comment.