-
Notifications
You must be signed in to change notification settings - Fork 909
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
06f5bdd
commit 794fc1c
Showing
2 changed files
with
130 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
157 changes: 129 additions & 28 deletions
157
docs/generated/HelpersStartChocolateyProcessAsAdmin.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,153 @@ | ||
# Start-ChocolateyProcessAsAdmin | ||
|
||
Runs a process as an administrator. If $exeToRun is not specified, it is run with PowerShell. | ||
**NOTE:** Administrative Access Required. | ||
|
||
**NOTE:** This command will assert UAC/Admin privileges on the machine. | ||
Runs a process with administrative privileges. If `-ExeToRun` is not | ||
specified, it is run with PowerShell. | ||
|
||
## Usage | ||
## Syntax | ||
|
||
```powershell | ||
Start-ChocolateyProcessAsAdmin $statements $exeToRun | ||
``` | ||
~~~powershell | ||
Start-ChocolateyProcessAsAdmin ` | ||
-Statements <String> ` | ||
[-ExeToRun <String>] ` | ||
[-Minimized] ` | ||
[-NoSleep] ` | ||
[-ValidExitCodes <Object>] ` | ||
[-IgnoredArguments <Object[]>] [<CommonParameters>] | ||
~~~ | ||
|
||
## Examples | ||
|
||
```powershell | ||
Start-ChocolateyProcessAsAdmin "$msiArgs" 'msiexec' | ||
## Notes | ||
|
||
Start-ChocolateyProcessAsAdmin "$silentArgs" $file | ||
This command will assert UAC/Admin privileges on the machine. | ||
|
||
Start-ChocolateyProcessAsAdmin "$silentArgs" $file -validExitCodes @(0,21) | ||
``` | ||
## Aliases | ||
|
||
```powershell | ||
$psFile = Join-Path "$(Split-Path -parent $MyInvocation.MyCommand.Definition)" 'someInstall.ps1' | ||
Start-ChocolateyProcessAsAdmin "& `'$psFile`'" | ||
``` | ||
None | ||
|
||
## Inputs | ||
|
||
None | ||
|
||
## Outputs | ||
|
||
None | ||
|
||
## Parameters | ||
|
||
* `-statements` | ||
### -Statements <String> | ||
Arguments to pass to `ExeToRun` or the PowerShell script block to be | ||
run. | ||
|
||
Property | Value | ||
---------------------- | ----- | ||
Aliases | | ||
Required? | true | ||
Position? | 1 | ||
Default Value | | ||
Accept Pipeline Input? | false | ||
|
||
### -ExeToRun [<String>] | ||
The executable/application/installer to run. Defaults to `'powershell'`. | ||
|
||
Property | Value | ||
---------------------- | ---------- | ||
Aliases | | ||
Required? | false | ||
Position? | 2 | ||
Default Value | powershell | ||
Accept Pipeline Input? | false | ||
|
||
### -Minimized | ||
Switch indicating if a Windows pops up (if not called with a silent | ||
argument) that it should be minimized. | ||
|
||
Property | Value | ||
---------------------- | ----- | ||
Aliases | | ||
Required? | false | ||
Position? | named | ||
Default Value | False | ||
Accept Pipeline Input? | false | ||
|
||
### -NoSleep | ||
Used only when calling PowerShell - indicates the window that is opened | ||
should return instantly when it is complete. | ||
|
||
Property | Value | ||
---------------------- | ----- | ||
Aliases | | ||
Required? | false | ||
Position? | named | ||
Default Value | False | ||
Accept Pipeline Input? | false | ||
|
||
### -ValidExitCodes [<Object>] | ||
Array of exit codes indicating success. Defaults to `@(0)`. | ||
|
||
Property | Value | ||
---------------------- | ----- | ||
Aliases | | ||
Required? | false | ||
Position? | named | ||
Default Value | @(0) | ||
Accept Pipeline Input? | false | ||
|
||
### -IgnoredArguments [<Object[]>] | ||
Allows splatting with arguments that do not apply. Do not use directly. | ||
|
||
Property | Value | ||
---------------------- | ----- | ||
Aliases | | ||
Required? | false | ||
Position? | named | ||
Default Value | | ||
Accept Pipeline Input? | false | ||
|
||
### <CommonParameters> | ||
|
||
This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see `about_CommonParameters` http://go.microsoft.com/fwlink/p/?LinkID=113216 . | ||
|
||
|
||
## Examples | ||
|
||
**EXAMPLE 1** | ||
|
||
~~~powershell | ||
Start-ChocolateyProcessAsAdmin -Statements "$msiArgs" -ExeToRun 'msiexec' | ||
~~~ | ||
|
||
**EXAMPLE 2** | ||
|
||
These are statements and/or arguments for an application. | ||
~~~powershell | ||
Start-ChocolateyProcessAsAdmin -Statements "$silentArgs" -ExeToRun $file | ||
Example: `'/i package /q'` | ||
~~~ | ||
|
||
* `-exeToRun` | ||
**EXAMPLE 3** | ||
|
||
This is the executable/application to run. | ||
~~~powershell | ||
Start-ChocolateyProcessAsAdmin -Statements "$silentArgs" -ExeToRun $file -ValidExitCodes @(0,21) | ||
Example: `cmd.exe` | ||
~~~ | ||
|
||
Defaults to `powershell` | ||
**EXAMPLE 4** | ||
|
||
~~~powershell | ||
# Run PowerShell statements | ||
$psFile = Join-Path "$(Split-Path -parent $MyInvocation.MyCommand.Definition)" 'someInstall.ps1' | ||
Start-ChocolateyProcessAsAdmin "& `'$psFile`'" | ||
~~~ | ||
|
||
* `-validExitCodes` _(optional)_ | ||
## Links | ||
|
||
If there are other valid exit codes besides zero signifying a successful install, please pass `-validExitCodes` with the value, including 0 as long as it is still valid. | ||
* [[Install-ChocolateyPackage|HelpersInstallChocolateyPackage]] | ||
* [[Install-ChocolateyInstallPackage|HelpersInstallChocolateyInstallPackage]] | ||
|
||
Example: `-validExitCodes @(0,44)` | ||
|
||
Defaults to `@(0)`. | ||
[[Function Reference|HelpersReference]] | ||
|
||
[[Function Reference|HelpersReference]] | ||
***NOTE:*** This documentation has been automatically generated from `Import-Module "$env:ChocolateyInstall\helpers\chocolateyInstaller.psm1" -Force; Get-Help Start-ChocolateyProcessAsAdmin -Full`. |