Skip to content

Commit 1c7e875

Browse files
authored
Format PowerShell code and fix line breaks
1 parent c18cc6b commit 1c7e875

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

reference/5.1/Microsoft.PowerShell.Management/Register-WmiEvent.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,12 @@ This example shows how to use an action to respond to an event. In this case, wh
8585
any `Start-Process` commands in the current session are written to an XML file.
8686

8787
```powershell
88-
$action = { Get-History | where { $_.CommandLine -like "*Start-Process*" } | Export-CliXml "commandHistory.clixml" }
89-
Register-WmiEvent -Class 'Win32_ProcessStartTrace' -SourceIdentifier "ProcessStarted" -Action $action
88+
$action = {
89+
Get-History |
90+
Where-Object { $_.CommandLine -like "*Start-Process*" } |
91+
Export-CliXml "commandHistory.clixml"
92+
}
93+
Register-WmiEvent -Class Win32_ProcessStartTrace -SourceIdentifier ProcessStarted -Action $action
9094
```
9195

9296
```Output
@@ -123,7 +127,8 @@ event is raised instead of sending the event to the event queue. Enclose the com
123127

124128
The value of **Action** can include the `$Event`, `$EventSubscriber`, `$Sender`, `$EventArgs`, and
125129
`$args` automatic variables, which provide information about the event to the **Action** script
126-
block. For more information, see [about_Automatic_Variables](../Microsoft.PowerShell.Core/About/about_Automatic_Variables.md).
130+
block. For more information, see
131+
[about_Automatic_Variables](../Microsoft.PowerShell.Core/About/about_Automatic_Variables.md).
127132

128133
When you specify an action, `Register-WmiEvent` returns an event job object that represents that
129134
action. You can use the cmdlets that contain the **Job** noun (the **Job** cmdlets) to manage the

0 commit comments

Comments
 (0)