Home Dashboard Directory Help
Search

Register-EngineEvent - MessageData is empty by Shay Levi


Status: 

Active


7
0
Sign in
to vote
Type: Bug
ID: 775898
Opened: 1/5/2013 11:42:17 PM
Access Restriction: Public
0
Workaround(s)
view
3
User(s) can reproduce this bug

Description

With Register-ObjectEvent I can pass a value in the MessageData parameter and get it when the event triggers (MessageData 42).


PS> $timer = New-Object Timers.Timer
PS> $timer.Interval = 500
PS> $job = Register-ObjectEvent -InputObject $timer -EventName Elapsed -SourceIdentifier Timer.Random -MessageData 42 -Action { $event | fl * }
PS> $timer.Enabled = $true

PS> Receive-Job $job

ComputerName     :
RunspaceId     : 8f50ec1a-0121-43cf-9d7b-a16715c5c3be
EventIdentifier : 12
Sender         : System.Timers.Timer
SourceEventArgs : System.Timers.ElapsedEventArgs
SourceArgs     : {System.Timers.Timer, System.Timers.ElapsedEventArgs}
SourceIdentifier : Timer.Random
TimeGenerated    : 1/4/2013 5:13:37 PM
MessageData     : 42



However, MessageData returns empty when using the Register-EngineEvent cmdlet


PS> Register-EngineEvent -SourceIdentifier foo -MessageData 42 -Action { $event.MessageData }
PS> New-Event -SourceIdentifier foo

ComputerName     :
RunspaceId     : 27ba0e03-ff61-4958-9d6f-ab3a19359141
EventIdentifier : 7
Sender         :
SourceEventArgs :
SourceArgs     : {}
SourceIdentifier : foo
TimeGenerated    : 24/12/2012 12:47:39
MessageData     :

Details
Sign in to post a comment.
Sign in to post a workaround.