diff --git a/reference/5.1/Microsoft.PowerShell.Management/Start-Process.md b/reference/5.1/Microsoft.PowerShell.Management/Start-Process.md index 1fe69c254af8..c94b9c6cfaa7 100644 --- a/reference/5.1/Microsoft.PowerShell.Management/Start-Process.md +++ b/reference/5.1/Microsoft.PowerShell.Management/Start-Process.md @@ -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 @@ -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 diff --git a/reference/7.2/Microsoft.PowerShell.Management/Start-Process.md b/reference/7.2/Microsoft.PowerShell.Management/Start-Process.md index c23550eefca2..dad2c0e703b1 100644 --- a/reference/7.2/Microsoft.PowerShell.Management/Start-Process.md +++ b/reference/7.2/Microsoft.PowerShell.Management/Start-Process.md @@ -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 @@ -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 diff --git a/reference/7.3/Microsoft.PowerShell.Management/Start-Process.md b/reference/7.3/Microsoft.PowerShell.Management/Start-Process.md index 130486735f1b..42105b085569 100644 --- a/reference/7.3/Microsoft.PowerShell.Management/Start-Process.md +++ b/reference/7.3/Microsoft.PowerShell.Management/Start-Process.md @@ -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 @@ -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 diff --git a/reference/7.4/Microsoft.PowerShell.Management/Start-Process.md b/reference/7.4/Microsoft.PowerShell.Management/Start-Process.md index 58076f596f25..79a5836d7fc1 100644 --- a/reference/7.4/Microsoft.PowerShell.Management/Start-Process.md +++ b/reference/7.4/Microsoft.PowerShell.Management/Start-Process.md @@ -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 @@ -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 @@ -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