Skip to content

Commit e1056e3

Browse files
Fix $Error, $Event and $ExecutionContext automatic variable case (2/13) (#11827)
* Fix $Error automatic variable case * Fix $Event automatic variable case * Fix $ExecutionContext automatic variable case
1 parent 1f28c5c commit e1056e3

File tree

22 files changed

+35
-35
lines changed

22 files changed

+35
-35
lines changed

.github/actions/.pwsh/module/functions/utility/Get-GHAConsoleError.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
properties to the fully qualified ID, the type of the error, the error message, and the target
77
object (which for GH CLI errors is always the command-line arguments for the failing command).
88
9-
It can retrieve errors from the `$error` variable or act on an input object.
9+
It can retrieve errors from the `$Error` variable or act on an input object.
1010
.PARAMETER Newest
1111
Specifies the number of error records to return, from newest to oldest.
1212
.PARAMETER InputObject
@@ -19,7 +19,7 @@
1919
The cmdlet gets the alternate view for the last error in the session.
2020
.EXAMPLE
2121
```powershell
22-
Get-GHAConsoleError -InputObject $error[0]
22+
Get-GHAConsoleError -InputObject $Error[0]
2323
```
2424
2525
The cmdlet gets the alternate view for the last error in the session.

.github/actions/.pwsh/module/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ This cmdlet returns an alternate view of an error record for the GH CLI. It limi
7878
properties to the fully qualified ID, the type of the error, the error message, and the target
7979
object (which for GH CLI errors is always the command-line arguments for the failing command).
8080

81-
It can retrieve errors from the `$error` variable or act on an input object.
81+
It can retrieve errors from the `$Error` variable or act on an input object.
8282

8383
For more information, review the [source code][utility-Get-GHAConsoleError]
8484

reference/5.1/CimCmdlets/Register-CimIndicationEvent.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,12 @@ Register-CimIndicationEvent -Query $query -SourceIdentifier "Timer"
9494
### Example 3: Run a script when the event arrives
9595

9696
This example shows how to use an action in response to an event. The variable `$action` holds the
97-
script block for **Action**, which uses the `$event` variable to access the event received from CIM.
97+
script block for **Action**, which uses the `$Event` variable to access the event received from CIM.
9898

9999
```powershell
100100
$action = {
101-
$name = $event.SourceEventArgs.NewEvent.ProcessName
102-
$id = $event.SourceEventArgs.NewEvent.ProcessId
101+
$name = $Event.SourceEventArgs.NewEvent.ProcessName
102+
$id = $Event.SourceEventArgs.NewEvent.ProcessId
103103
Write-Host -Object "New Process Started : Name = $name ID = $id"
104104
}
105105
$event = @{

reference/5.1/Microsoft.PowerShell.Core/About/about_CommonParameters.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ You can use this parameter to create a variable that contains only error
202202
messages from specific commands and doesn't affect the behavior of the `$Error`
203203
automatic variable. The `$Error` automatic variable contains error messages
204204
from all the commands in the session. You can use array notation, such as
205-
`$a[0]` or `$error[1,2]` to refer to specific errors stored in the variables.
205+
`$a[0]` or `$Error[1,2]` to refer to specific errors stored in the variables.
206206

207207
> [!NOTE]
208208
> The custom error variable contains all errors generated by the command,

reference/5.1/Microsoft.PowerShell.Core/About/about_Prompts.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ For example:
7373
```
7474

7575
```Output
76-
"PS $($executionContext.SessionState.Path.CurrentLocation)$('>' * ($nestedPromptLevel + 1)) "
76+
"PS $($ExecutionContext.SessionState.Path.CurrentLocation)$('>' * ($nestedPromptLevel + 1)) "
7777
# .Link
7878
# https://go.microsoft.com/fwlink/?LinkID=225750
7979
# .ExternalHelp System.Management.Automation.dll-help.xml
@@ -114,7 +114,7 @@ PowerShell includes a built-in `Prompt` function.
114114

115115
```powershell
116116
function prompt {
117-
"PS $($executionContext.SessionState.Path.CurrentLocation)$('>' * ($nestedPromptLevel + 1)) ";
117+
"PS $($ExecutionContext.SessionState.Path.CurrentLocation)$('>' * ($nestedPromptLevel + 1)) ";
118118
# .Link
119119
# https://go.microsoft.com/fwlink/?LinkID=225750
120120
# .ExternalHelp System.Management.Automation.dll-help.xml

reference/5.1/Microsoft.PowerShell.Core/About/about_Scripts.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ The following example shows a `Test-Remote.ps1` script that has a
184184
param ($ComputerName = $(throw "ComputerName parameter is required."))
185185
186186
function CanPing {
187-
$error.Clear()
187+
$Error.Clear()
188188
$tmp = Test-Connection $computername -ErrorAction SilentlyContinue
189189
190190
if (!$?)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ data to a text file.
8181

8282
```powershell
8383
Register-EngineEvent -SourceIdentifier MyEventSource -Action {
84-
"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
8585
}
8686
8787
Start-Job -Name TestJob -ScriptBlock {

reference/7.4/CimCmdlets/Register-CimIndicationEvent.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,12 @@ Register-CimIndicationEvent -Query $query -SourceIdentifier "Timer"
9696
### Example 3: Run a script when the event arrives
9797

9898
This example shows how to use an action in response to an event. The variable `$action` holds the
99-
script block for **Action**, which uses the `$event` variable to access the event received from CIM.
99+
script block for **Action**, which uses the `$Event` variable to access the event received from CIM.
100100

101101
```powershell
102102
$action = {
103-
$name = $event.SourceEventArgs.NewEvent.ProcessName
104-
$id = $event.SourceEventArgs.NewEvent.ProcessId
103+
$name = $Event.SourceEventArgs.NewEvent.ProcessName
104+
$id = $Event.SourceEventArgs.NewEvent.ProcessId
105105
Write-Host -Object "New Process Started : Name = $name ID = $id"
106106
}
107107
$event = @{

reference/7.4/Microsoft.PowerShell.Core/About/about_CommonParameters.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ You can use this parameter to create a variable that contains only error
196196
messages from specific commands and doesn't affect the behavior of the `$Error`
197197
automatic variable. The `$Error` automatic variable contains error messages
198198
from all the commands in the session. You can use array notation, such as
199-
`$a[0]` or `$error[1,2]` to refer to specific errors stored in the variables.
199+
`$a[0]` or `$Error[1,2]` to refer to specific errors stored in the variables.
200200

201201
> [!NOTE]
202202
> The custom error variable contains all errors generated by the command,

reference/7.4/Microsoft.PowerShell.Core/About/about_Prompts.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ For example:
7373
```
7474

7575
```Output
76-
"PS $($executionContext.SessionState.Path.CurrentLocation)$('>' * ($nestedPromptLevel + 1)) "
76+
"PS $($ExecutionContext.SessionState.Path.CurrentLocation)$('>' * ($nestedPromptLevel + 1)) "
7777
# .Link
7878
# https://go.microsoft.com/fwlink/?LinkID=225750
7979
# .ExternalHelp System.Management.Automation.dll-help.xml
@@ -114,7 +114,7 @@ PowerShell includes a built-in `Prompt` function.
114114

115115
```powershell
116116
function prompt {
117-
"PS $($executionContext.SessionState.Path.CurrentLocation)$('>' * ($nestedPromptLevel + 1)) ";
117+
"PS $($ExecutionContext.SessionState.Path.CurrentLocation)$('>' * ($nestedPromptLevel + 1)) ";
118118
# .Link
119119
# https://go.microsoft.com/fwlink/?LinkID=225750
120120
# .ExternalHelp System.Management.Automation.dll-help.xml

0 commit comments

Comments
 (0)