Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ The `Remove-WmiObject` cmdlet deletes an instance of an existing Windows Managem

```powershell
notepad
$np = Get-WmiObject -Query "select * from win32_process where name='notepad.exe'"
$np = Get-WmiObject -Query "select * from Win32_Process where name='notepad.exe'"
$np | Remove-WmiObject
```

Expand All @@ -96,14 +96,14 @@ instances of Notepad.exe.
This command deletes the C:\Test folder.

```powershell
$a = Get-WMIObject -Query "Select * From Win32_Directory Where Name ='C:\\Test'"
$a | Remove-WMIObject
$a = Get-WmiObject -Query "Select * From Win32_Directory Where Name ='C:\\Test'"
$a | Remove-WmiObject
```

The first command uses `Get-WMIObject` to query for the `C:\Test` folder, and then stores the object
The first command uses `Get-WmiObject` to query for the `C:\Test` folder, and then stores the object
in the `$a` variable.

The second command pipes the `$a` variable to `Remove-WMIObject`, which deletes the folder.
The second command pipes the `$a` variable to `Remove-WmiObject`, which deletes the folder.

## PARAMETERS

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,16 @@ password in the domain.

```powershell
$cred = Get-Credential
Invoke-Command -ComputerName "Server01" -ScriptBlock {Reset-ComputerMachinePassword -Credential $using:cred}
Invoke-Command -ComputerName "Server01" -ScriptBlock {
Reset-ComputerMachinePassword -Credential $Using:cred
}
```

This command uses the Invoke-Command cmdlet to run a `Reset-ComputerMachinePassword` command on the
Server01 remote computer.

For more information about remote commands in Windows PowerShell, see [about_Remote](../Microsoft.PowerShell.Core/About/about_Remote.md)
and `Invoke-Command`.
For more information about remote commands in Windows PowerShell, see
[about_Remote](../Microsoft.PowerShell.Core/About/about_Remote.md) and `Invoke-Command`.

## PARAMETERS

Expand Down Expand Up @@ -141,7 +143,8 @@ Accept wildcard characters: False

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
-InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose,
-WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).
-WarningAction, and -WarningVariable. For more information, see
[about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).

## INPUTS

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ reflects the new value.

```powershell
$setWmiInstanceSplat = @{
Class = 'win32_environment'
Class = 'Win32_Environment'
Arguments = @{
Name="testvar"
VariableValue="testvalue"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ This method is an alternative to using a `Show-ControlPanelItem` command.

> [!NOTE]
> In PowerShell, you can omit the .cpl file extension for control panel files because it's included
> in the value of the `$env:PathExt` environment variable.
> in the value of the `$Env:PATHEXT` environment variable.

## PARAMETERS

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Windows PowerShell. For more information, see [about_Transactions](../Microsoft.
### Example 1: Start and roll back a transaction

```powershell
Set-Location hkcu:\software
Set-Location HKCU:\software
Start-Transaction
New-Item "ContosoCompany" -UseTransaction
New-ItemProperty "ContosoCompany" -Name "MyKey" -Value 123 -UseTransaction
Expand All @@ -65,7 +65,7 @@ changes are made to the registry.
### Example 2: Start and complete a transaction

```powershell
Set-Location hkcu:\software
Set-Location HKCU:\software
Start-Transaction
New-Item "ContosoCompany" -UseTransaction
New-ItemProperty "ContosoCompany" -Name "MyKey" -Value 123 -UseTransaction
Expand All @@ -82,11 +82,11 @@ Set-Location HKCU:\software
Start-Transaction
New-Item -Path "NoPath" -Name "ContosoCompany" -UseTransaction
New-Item -Path . -Name "ContosoCompany" -UseTransaction
Start-Transaction -RollbackPreference never
Start-Transaction -RollbackPreference Never
New-Item -Path "NoPath" -Name "ContosoCompany" -UseTransaction
New-Item -Path . -Name "ContosoCompany" -UseTransaction

# Start-Transaction (-rollbackpreference error)
# Start-Transaction (-RollbackPreference Error)

Start-Transaction
New-Item -Path "NoPath" -Name "ContosoCompany" -UseTransaction
Expand All @@ -95,7 +95,7 @@ New-Item : The registry key at the specified path does not exist.

```Output
At line:1 char:9
+ new-item <<<< -Path NoPath -Name ContosoCompany -UseTransaction
+ New-Item <<<< -Path NoPath -Name ContosoCompany -UseTransaction
```

```powershell
Expand All @@ -109,9 +109,9 @@ At line:1 char:9
```

```powershell
# Start-Transaction (-rollbackpreference never)
# Start-Transaction (-RollbackPreference Never)

Start-Transaction -RollbackPreference never
Start-Transaction -RollbackPreference Never
New-Item -Path "NoPath" -Name "ContosoCompany" -UseTransaction
```

Expand Down Expand Up @@ -235,7 +235,7 @@ As a result, the registry is changed.
### Example 6: Run commands that are not part of a transaction

```powershell
Set-Location hkcu:\software
Set-Location HKCU:\software
Start-Transaction
New-Item "ContosoCompany1" -UseTransaction
New-Item "ContosoCompany2"
Expand Down Expand Up @@ -308,7 +308,7 @@ New-Item HKCU:\Software\ContosoCompany -UseTransaction
```Output
New-Item : Cannot use transaction. The transaction has been rolled back or has timed out.
At line:1 char:9
+ new-item <<<< MyCompany -UseTransaction
+ New-Item <<<< MyCompany -UseTransaction
```

This command uses the **Timeout** parameter of `Start-Transaction` to start a transaction that must
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ multiple connections, it returns an array of **Boolean** values.

## NOTES

This cmdlet uses the **Win32_PingStatus** class. A `Get-WMIObject Win32_PingStatus` command is
This cmdlet uses the **Win32_PingStatus** class. A `Get-WmiObject Win32_PingStatus` command is
equivalent to a `Test-Connection` command.

The **Source** parameter set was introduced in PowerShell 3.0.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ This command rolls back the current, active, transaction.
### Example 2: Start and roll back a transaction

```powershell
Set-Location hkcu:\software
Set-Location HKCU:\software
Start-Transaction
New-Item -Path "ContosoCompany" -UseTransaction
Undo-Transaction
Expand All @@ -60,7 +60,7 @@ registry.
### Example 3: Roll back a transaction for all subscribers

```powershell
Set-Location hkcu:\software
Set-Location HKCU:\software
Start-Transaction
New-Item -Path "ContosoCompany" -UseTransaction
Get-Transaction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ Accept wildcard characters: False
### -UseTransaction

Includes the command in the active transaction. This parameter is valid only when a transaction is
in progress. For more information, see [about_transactions](../Microsoft.PowerShell.Core/About/about_Transactions.md).
in progress. For more information, see [about_Transactions](../Microsoft.PowerShell.Core/About/about_Transactions.md).

```yaml
Type: System.Management.Automation.SwitchParameter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ Wild Shrimp, (111) 222-3333, 1
'@
$PersonalData = $testText | ConvertFrom-String -TemplateContent $template
Write-output ("Pet items found: " + ($PersonalData.Count))
Write-Output ("Pet items found: " + ($PersonalData.Count))
$PersonalData
```

Expand Down Expand Up @@ -206,7 +206,7 @@ Wild Shrimp, (111) 222-3333, 1
'@
$PersonalData = $testText | ConvertFrom-String -TemplateContent $template
Write-output ("Pet items found: " + ($PersonalData.Count))
Write-Output ("Pet items found: " + ($PersonalData.Count))
$PersonalData
```

Expand Down
2 changes: 1 addition & 1 deletion reference/5.1/PSReadLine/Get-PSReadLineOption.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
external help file: Microsoft.PowerShell.PSReadLine2.dll-Help.xml
Locale: en-US
Module Name: PSReadline
Module Name: PSReadLine
ms.date: 12/13/2022
online version: https://learn.microsoft.com/powershell/module/psreadline/get-psreadlineoption?view=powershell-5.1&WT.mc_id=ps-gethelp
schema: 2.0.0
Expand Down
2 changes: 1 addition & 1 deletion reference/5.1/PSReadLine/Remove-PSReadLineKeyHandler.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
external help file: Microsoft.PowerShell.PSReadLine2.dll-Help.xml
Locale: en-US
Module Name: PSReadline
Module Name: PSReadLine
ms.date: 12/13/2022
online version: https://learn.microsoft.com/powershell/module/psreadline/remove-psreadlinekeyhandler?view=powershell-5.1&WT.mc_id=ps-gethelp
schema: 2.0.0
Expand Down
2 changes: 1 addition & 1 deletion reference/5.1/PSReadLine/Set-PSReadLineKeyHandler.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
external help file: Microsoft.PowerShell.PSReadLine2.dll-Help.xml
Locale: en-US
Module Name: PSReadline
Module Name: PSReadLine
ms.date: 10/02/2023
online version: https://learn.microsoft.com/powershell/module/psreadline/set-psreadlinekeyhandler?view=powershell-5.1&WT.mc_id=ps-gethelp
schema: 2.0.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ The `Receive-Job` cmdlet gets the results of the most recent instance of the
**ProcessJob** scheduled job (ID = 51).

```powershell
Receive-Job -ID 51
Receive-Job -Id 51
```

Even though the `Receive-Job` command did not include the **Keep** parameter,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ Mode LastWriteTime Length Name
```

You can open and examine the **ScheduledJobDefinition.xml**, **Results.xml**
and **Status.xml** files or use the `Select-XML` cmdlet to parse the files.
and **Status.xml** files or use the `Select-Xml` cmdlet to parse the files.

> [!WARNING]
> Do not edit the XML files. If any XML file contains invalid XML, PowerShell
Expand Down Expand Up @@ -145,7 +145,8 @@ Start-Job -DefinitionName ProcessJob
```

To manage the job and get the job results, use the job cmdlets. For more
information about the job cmdlets, see [about_Jobs](../../Microsoft.PowerShell.Core/About/about_Jobs.md).
information about the job cmdlets, see
[about_Jobs](../../Microsoft.PowerShell.Core/About/about_Jobs.md).

> [!NOTE]
> To use the Job cmdlets on instances of scheduled jobs, the **PSScheduledJob**
Expand All @@ -172,9 +173,9 @@ instance in a table. A calculated property named **Label** displays the elapsed
time of each job instance.

```powershell
Get-job -Name UpdateHelpJob |
Format-Table -Property ID, PSBeginTime, PSEndTime,
@{Label="Elapsed Time";Expression={$.PsEndTime - $.PSBeginTime}}
Get-Job -Name UpdateHelpJob |
Format-Table -Property Id, PSBeginTime, PSEndTime,
@{Label="Elapsed Time";Expression={$.PSEndTime - $.PSBeginTime}}
```

```Output
Expand Down Expand Up @@ -213,7 +214,8 @@ new instances of the scheduled job.

The following example uses splatting to create `$JobParms` which are parameter
values that are passed to the `Register-ScheduledJob` cmdlet. For more
information, see [about_Splatting.md](../../Microsoft.PowerShell.Core/About/about_Splatting.md).
information, see
[about_Splatting.md](../../Microsoft.PowerShell.Core/About/about_Splatting.md).
The `Register-ScheduledJob` uses `@JobParms` to create a scheduled job. The
command uses the **MaxResultCount** parameter with a value of 12 to save only
the 12 newest job instance results of the scheduled job.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ Monday and Thursday at 5:00 AM.
## How to get a job trigger

To get the job trigger of a scheduled job, use the `Get-JobTrigger` cmdlet. Use
the **Name**, **ID**, and **InputObject** parameters to specify the scheduled
the **Name**, **Id**, and **InputObject** parameters to specify the scheduled
job, not the job trigger.

`Get-JobTrigger` gets the job trigger of the **ProcessJob**.
Expand Down Expand Up @@ -149,7 +149,7 @@ $O = New-ScheduledJobOption -WakeToRun
## How to get job options

To get the job options of a scheduled job, use the `Get-ScheduledJobOption`
cmdlet. Use the **Name**, **ID**, and **InputObject** parameters to specify the
cmdlet. Use the **Name**, **Id**, and **InputObject** parameters to specify the
scheduled job, not the job options.

`Get-ScheduledJobOption` gets the job options of the **ProcessJob**.
Expand Down Expand Up @@ -200,7 +200,7 @@ value of the **WakeToRun** option of the **ProcessJob** scheduledJob to
**True**.

The `Set` cmdlets in the **PSScheduledJob** module, such as the
`Set-ScheduledJobOption` cmdlet, don't have **Name** or **ID** parameters. You
`Set-ScheduledJobOption` cmdlet, don't have **Name** or **Id** parameters. You
can use the **InputObject** parameter to specify the scheduled job options or
pipe a scheduled job from `Get-ScheduledJobOption` cmdlet to
`Set-ScheduledJobOption`.
Expand Down Expand Up @@ -258,11 +258,11 @@ The default display does not show the start time, which typically distinguishes
instances of the same scheduled job.

The `Get-Job` cmdlet sends objects down the pipeline. The `Format-Table` cmdlet
displays the **Name**, **ID**, and **BeginTime** properties of the scheduled
displays the **Name**, **Id**, and **BeginTime** properties of the scheduled
job.

```powershell
Get-Job ProcessJob | Format-Table -Property Name, ID, BeginTime
Get-Job ProcessJob | Format-Table -Property Name, Id, BeginTime
```

```Output
Expand Down Expand Up @@ -294,7 +294,7 @@ This examples gets the results of the newest instance of the

```powershell
Import-Module PSScheduledJob
Receive-Job -ID 51 -Keep
Receive-Job -Id 51 -Keep
```

The results of scheduled jobs are saved on disk, so the **Keep** parameter of
Expand Down
Loading