Skip to content

Commit

Permalink
Remove broken example (#10607)
Browse files Browse the repository at this point in the history
  • Loading branch information
sdwheeler authored Nov 1, 2023
1 parent 287aa2b commit c0720e0
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 88 deletions.
22 changes: 1 addition & 21 deletions reference/5.1/Microsoft.PowerShell.Management/Start-Process.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
external help file: Microsoft.PowerShell.Commands.Management.dll-Help.xml
Locale: en-US
Module Name: Microsoft.PowerShell.Management
ms.date: 12/12/2022
ms.date: 11/01/2023
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.management/start-process?view=powershell-5.1&WT.mc_id=ps-gethelp
schema: 2.0.0
title: Start-Process
Expand Down Expand Up @@ -135,26 +135,6 @@ Start-Process -FilePath "$env:comspec" -ArgumentList "/c dir `"%SystemDrive%\Pro
Start-Process -FilePath "$env:comspec" -ArgumentList "/c","dir","`"%SystemDrive%\Program Files`""
```

### Example 8: Run a command as an Administrator using alternate credentials

On Windows, you can run `Start-Process -Verb RunAs` to start a process with elevated permissions.
This elevates the current user's context. The **Credential** parameter allows you to specify an
alternate username and password, allowing you to start a process in a different user content.
However, the **Credential** and **Verb** parameters can't be used together.

To start a process with elevated rights, using alternate credentials, you must first start
PowerShell using the alternate credentials, then use `Start-Process` to start the process with
elevated rights.

```powershell
$cred = Get-Credential
$args = '-noprofile -command "Start-Process cmd.exe -Verb RunAs -args /k"'
Start-Process pwsh.exe -Credential $cred -WindowStyle Hidden -ArgumentList $args
```

The example starts `cmd.exe` with elevated permissions from a PowerShell session that is running
under alternate credentials.

## PARAMETERS

### -ArgumentList
Expand Down
24 changes: 2 additions & 22 deletions reference/7.2/Microsoft.PowerShell.Management/Start-Process.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
external help file: Microsoft.PowerShell.Commands.Management.dll-Help.xml
Locale: en-US
Module Name: Microsoft.PowerShell.Management
ms.date: 12/12/2022
ms.date: 11/01/2023
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.management/start-process?view=powershell-7.2&WT.mc_id=ps-gethelp
schema: 2.0.0
title: Start-Process
Expand Down Expand Up @@ -136,27 +136,7 @@ Start-Process -FilePath "$env:comspec" -ArgumentList "/c dir `"%SystemDrive%\Pro
Start-Process -FilePath "$env:comspec" -ArgumentList "/c","dir","`"%SystemDrive%\Program Files`""
```

### Example 8: Run a command as an Administrator using alternate credentials

On Windows, you can run `Start-Process -Verb RunAs` to start a process with elevated permissions.
This elevates the current user's context. The **Credential** parameter allows you to specify an
alternate username and password, allowing you to start a process in a different user content.
However, the **Credential** and **Verb** parameters can't be used together.

To start a process with elevated rights, using alternate credentials, you must first start
PowerShell using the alternate credentials, then use `Start-Process` to start the process with
elevated rights.

```powershell
$cred = Get-Credential
$args = '-noprofile -command "Start-Process cmd.exe -Verb RunAs -args /k"'
Start-Process pwsh.exe -Credential $cred -WindowStyle Hidden -ArgumentList $args
```

The example starts `cmd.exe` with elevated permissions from a PowerShell session that is running
under alternate credentials.

### Example 9: Create a detached process on Linux
### Example 8: Create a detached process on Linux

On Windows, `Start-Process` creates an independent process that remains running independently of the
launching shell. On non-Windows platforms, the newly started process is attached to the shell that
Expand Down
24 changes: 2 additions & 22 deletions reference/7.3/Microsoft.PowerShell.Management/Start-Process.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
external help file: Microsoft.PowerShell.Commands.Management.dll-Help.xml
Locale: en-US
Module Name: Microsoft.PowerShell.Management
ms.date: 12/12/2022
ms.date: 11/01/2023
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.management/start-process?view=powershell-7.3&WT.mc_id=ps-gethelp
schema: 2.0.0
title: Start-Process
Expand Down Expand Up @@ -136,27 +136,7 @@ Start-Process -FilePath "$env:comspec" -ArgumentList "/c dir `"%SystemDrive%\Pro
Start-Process -FilePath "$env:comspec" -ArgumentList "/c","dir","`"%SystemDrive%\Program Files`""
```

### Example 8: Run a command as an Administrator using alternate credentials

On Windows, you can run `Start-Process -Verb RunAs` to start a process with elevated permissions.
This elevates the current user's context. The **Credential** parameter allows you to specify an
alternate username and password, allowing you to start a process in a different user content.
However, the **Credential** and **Verb** parameters can't be used together.

To start a process with elevated rights, using alternate credentials, you must first start
PowerShell using the alternate credentials, then use `Start-Process` to start the process with
elevated rights.

```powershell
$cred = Get-Credential
$args = '-noprofile -command "Start-Process cmd.exe -Verb RunAs -args /k"'
Start-Process pwsh.exe -Credential $cred -WindowStyle Hidden -ArgumentList $args
```

The example starts `cmd.exe` with elevated permissions from a PowerShell session that is running
under alternate credentials.

### Example 9: Create a detached process on Linux
### Example 8: Create a detached process on Linux

On Windows, `Start-Process` creates an independent process that remains running independently of the
launching shell. On non-Windows platforms, the newly started process is attached to the shell that
Expand Down
26 changes: 3 additions & 23 deletions reference/7.4/Microsoft.PowerShell.Management/Start-Process.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
external help file: Microsoft.PowerShell.Commands.Management.dll-Help.xml
Locale: en-US
Module Name: Microsoft.PowerShell.Management
ms.date: 04/21/2023
ms.date: 11/01/2023
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.management/start-process?view=powershell-7.4&WT.mc_id=ps-gethelp
schema: 2.0.0
title: Start-Process
Expand Down Expand Up @@ -134,27 +134,7 @@ Start-Process -FilePath "$env:comspec" -ArgumentList "/c dir `"%SystemDrive%\Pro
Start-Process -FilePath "$env:comspec" -ArgumentList "/c","dir","`"%SystemDrive%\Program Files`""
```

### Example 8: Run a command as an Administrator using alternate credentials

On Windows, you can run `Start-Process -Verb RunAs` to start a process with elevated permissions.
This elevates the current user's context. The **Credential** parameter allows you to specify an
alternate username and password, allowing you to start a process in a different user content.
However, the **Credential** and **Verb** parameters can't be used together.

To start a process with elevated rights, using alternate credentials, you must first start
PowerShell using the alternate credentials, then use `Start-Process` to start the process with
elevated rights.

```powershell
$cred = Get-Credential
$args = '-noprofile -command "Start-Process cmd.exe -Verb RunAs -args /k"'
Start-Process pwsh.exe -Credential $cred -WindowStyle Hidden -ArgumentList $args
```

The example starts `cmd.exe` with elevated permissions from a PowerShell session that is running
under alternate credentials.

### Example 9: Create a detached process on Linux
### Example 8: Create a detached process on Linux

On Windows, `Start-Process` creates an independent process that remains running independently of the
launching shell. On non-Windows platforms, the newly started process is attached to the shell that
Expand All @@ -174,7 +154,7 @@ In this example, `Start-Process` is running the Linux `nohup` command, which lau
detached process. For more information, see the [nohup](https://wikipedia.org/wiki/Nohup) article on
Wikipedia.

### Example 10: Overriding an environment variable for a process
### Example 9: Overriding an environment variable for a process

By default, when you use `Start-Process`, the new process is created with the same environment
variables as the current session. You can use the **Environment** parameter to override the values
Expand Down

0 comments on commit c0720e0

Please sign in to comment.