Skip to content

Commit 8dba7f0

Browse files
authored
Fix description of MessageData parameter (#11663)
1 parent 2c2c2fb commit 8dba7f0

File tree

3 files changed

+36
-21
lines changed

3 files changed

+36
-21
lines changed

reference/5.1/Microsoft.PowerShell.Utility/Register-EngineEvent.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml
33
Locale: en-US
44
Module Name: Microsoft.PowerShell.Utility
5-
ms.date: 12/12/2022
5+
ms.date: 01/13/2025
66
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/register-engineevent?view=powershell-5.1&WT.mc_id=ps-gethelp
77
schema: 2.0.0
88
title: Register-EngineEvent
@@ -16,8 +16,9 @@ Subscribes to events that are generated by the PowerShell engine and by the `New
1616
## SYNTAX
1717

1818
```
19-
Register-EngineEvent [-SourceIdentifier] <String> [[-Action] <ScriptBlock>] [-MessageData <PSObject>]
20-
[-SupportEvent] [-Forward] [-MaxTriggerCount <Int32>] [<CommonParameters>]
19+
Register-EngineEvent [-SourceIdentifier] <String> [[-Action] <ScriptBlock>]
20+
[-MessageData <PSObject>] [-SupportEvent] [-Forward] [-MaxTriggerCount <Int32>]
21+
[<CommonParameters>]
2122
```
2223

2324
## DESCRIPTION
@@ -80,15 +81,19 @@ data to a text file.
8081

8182
```powershell
8283
Register-EngineEvent -SourceIdentifier MyEventSource -Action {
83-
"Event: {0}" -f $event.messagedata | Out-File c:\temp\MyEvents.txt -Append
84+
"Event: {0}" -f $event.MessageData | Out-File c:\temp\MyEvents.txt -Append
8485
}
8586
8687
Start-Job -Name TestJob -ScriptBlock {
8788
While ($True) {
8889
Register-EngineEvent -SourceIdentifier MyEventSource -Forward
8990
Start-Sleep -seconds 2
9091
"Doing some work..."
91-
New-Event -SourceIdentifier MyEventSource -Message ("{0} - Work done..." -f (Get-Date))
92+
$newEventSplat = @{
93+
SourceIdentifier = 'MyEventSource'
94+
MessageData = ("{0} - Work done..." -f (Get-Date))
95+
}
96+
New-Event @newEventSplat
9297
}
9398
}
9499
Start-Sleep -seconds 4
@@ -209,8 +214,8 @@ Accept wildcard characters: False
209214
210215
### -MessageData
211216
212-
Specifies additional data associated with the event. The value of this parameter appears in the
213-
**MessageData** property of the event object.
217+
This parameter is part of the base class for all Event cmdlets. The `Register-EngineEvent` doesn't
218+
use this parameter. Any data passed to this parameter is ignored.
214219

215220
```yaml
216221
Type: System.Management.Automation.PSObject

reference/7.4/Microsoft.PowerShell.Utility/Register-EngineEvent.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml
33
Locale: en-US
44
Module Name: Microsoft.PowerShell.Utility
5-
ms.date: 12/12/2022
5+
ms.date: 01/13/2025
66
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/register-engineevent?view=powershell-7.4&WT.mc_id=ps-gethelp
77
schema: 2.0.0
88
title: Register-EngineEvent
@@ -16,8 +16,9 @@ Subscribes to events that are generated by the PowerShell engine and by the `New
1616
## SYNTAX
1717

1818
```
19-
Register-EngineEvent [-SourceIdentifier] <String> [[-Action] <ScriptBlock>] [-MessageData <PSObject>]
20-
[-SupportEvent] [-Forward] [-MaxTriggerCount <Int32>] [<CommonParameters>]
19+
Register-EngineEvent [-SourceIdentifier] <String> [[-Action] <ScriptBlock>]
20+
[-MessageData <PSObject>] [-SupportEvent] [-Forward] [-MaxTriggerCount <Int32>]
21+
[<CommonParameters>]
2122
```
2223

2324
## DESCRIPTION
@@ -80,15 +81,19 @@ data to a text file.
8081

8182
```powershell
8283
Register-EngineEvent -SourceIdentifier MyEventSource -Action {
83-
"Event: {0}" -f $event.messagedata | Out-File c:\temp\MyEvents.txt -Append
84+
"Event: {0}" -f $event.MessageData | Out-File c:\temp\MyEvents.txt -Append
8485
}
8586
8687
Start-Job -Name TestJob -ScriptBlock {
8788
While ($True) {
8889
Register-EngineEvent -SourceIdentifier MyEventSource -Forward
8990
Start-Sleep -seconds 2
9091
"Doing some work..."
91-
New-Event -SourceIdentifier MyEventSource -Message ("{0} - Work done..." -f (Get-Date))
92+
$newEventSplat = @{
93+
SourceIdentifier = 'MyEventSource'
94+
MessageData = ("{0} - Work done..." -f (Get-Date))
95+
}
96+
New-Event @newEventSplat
9297
}
9398
}
9499
Start-Sleep -seconds 4
@@ -209,8 +214,8 @@ Accept wildcard characters: False
209214
210215
### -MessageData
211216
212-
Specifies additional data associated with the event. The value of this parameter appears in the
213-
**MessageData** property of the event object.
217+
This parameter is part of the base class for all Event cmdlets. The `Register-EngineEvent` doesn't
218+
use this parameter. Any data passed to this parameter is ignored.
214219

215220
```yaml
216221
Type: System.Management.Automation.PSObject

reference/7.5/Microsoft.PowerShell.Utility/Register-EngineEvent.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml
33
Locale: en-US
44
Module Name: Microsoft.PowerShell.Utility
5-
ms.date: 12/12/2022
5+
ms.date: 01/13/2025
66
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/register-engineevent?view=powershell-7.5&WT.mc_id=ps-gethelp
77
schema: 2.0.0
88
title: Register-EngineEvent
@@ -16,8 +16,9 @@ Subscribes to events that are generated by the PowerShell engine and by the `New
1616
## SYNTAX
1717

1818
```
19-
Register-EngineEvent [-SourceIdentifier] <String> [[-Action] <ScriptBlock>] [-MessageData <PSObject>]
20-
[-SupportEvent] [-Forward] [-MaxTriggerCount <Int32>] [<CommonParameters>]
19+
Register-EngineEvent [-SourceIdentifier] <String> [[-Action] <ScriptBlock>]
20+
[-MessageData <PSObject>] [-SupportEvent] [-Forward] [-MaxTriggerCount <Int32>]
21+
[<CommonParameters>]
2122
```
2223

2324
## DESCRIPTION
@@ -80,15 +81,19 @@ data to a text file.
8081

8182
```powershell
8283
Register-EngineEvent -SourceIdentifier MyEventSource -Action {
83-
"Event: {0}" -f $event.messagedata | Out-File c:\temp\MyEvents.txt -Append
84+
"Event: {0}" -f $event.MessageData | Out-File c:\temp\MyEvents.txt -Append
8485
}
8586
8687
Start-Job -Name TestJob -ScriptBlock {
8788
While ($True) {
8889
Register-EngineEvent -SourceIdentifier MyEventSource -Forward
8990
Start-Sleep -seconds 2
9091
"Doing some work..."
91-
New-Event -SourceIdentifier MyEventSource -Message ("{0} - Work done..." -f (Get-Date))
92+
$newEventSplat = @{
93+
SourceIdentifier = 'MyEventSource'
94+
MessageData = ("{0} - Work done..." -f (Get-Date))
95+
}
96+
New-Event @newEventSplat
9297
}
9398
}
9499
Start-Sleep -seconds 4
@@ -209,8 +214,8 @@ Accept wildcard characters: False
209214
210215
### -MessageData
211216
212-
Specifies additional data associated with the event. The value of this parameter appears in the
213-
**MessageData** property of the event object.
217+
This parameter is part of the base class for all Event cmdlets. The `Register-EngineEvent` doesn't
218+
use this parameter. Any data passed to this parameter is ignored.
214219

215220
```yaml
216221
Type: System.Management.Automation.PSObject

0 commit comments

Comments
 (0)