# encoding: ascii
# api: powershell
# title: Start-ProcessAsAdministr
# description: Original author: James Brundage @ Microsoft
# version: 0.1
# type: function
# author: halr9000
# license: CC0
# function: Start-ProcessAsAdministrator
# x-poshcode-id: 1057
# x-archived: 2016-03-05T14:57:22
# x-published: 2010-04-23T19:09:00
#
#
function Start-ProcessAsAdministrator
{
    <#
    .ForwardHelpTargetName Start-Process
    .ForwardHelpCategory Cmdlet
    #>
    [CmdletBinding(DefaultParameterSetName='Default')]
    param(
    [Parameter(Mandatory=$true, Position=0)]
    [Alias('PSPath')]
    [ValidateNotNullOrEmpty()]
    [System.String]
    $FilePath,

    [Parameter(Position=1)]
    [Alias('Args')]
    [ValidateNotNullOrEmpty()]
    [System.String[]]
    $ArgumentList,

    [Parameter(ParameterSetName='Default')]
    [Alias('RunAs')]
    [ValidateNotNullOrEmpty()]
    [System.Management.Automation.PSCredential]
    $Credential,

    [ValidateNotNullOrEmpty()]
    [System.String]
    $WorkingDirectory,

    [Parameter(ParameterSetName='Default')]
    [Alias('Lup')]
    [Switch]
    $LoadUserProfile,

    [Parameter(ParameterSetName='Default')]
    [Alias('nnw')]
    [Switch]
    $NoNewWindow,

    [Switch]
    $PassThru,

    [Parameter(ParameterSetName='Default')]
    [Alias('RSE')]
    [ValidateNotNullOrEmpty()]
    [System.String]
    $RedirectStandardError,

    [Parameter(ParameterSetName='Default')]
    [Alias('RSI')]
    [ValidateNotNullOrEmpty()]
    [System.String]
    $RedirectStandardInput,

    [Parameter(ParameterSetName='Default')]
    [Alias('RSO')]
    [ValidateNotNullOrEmpty()]
    [System.String]
    $RedirectStandardOutput,

    [Switch]
    $Wait,

    [Parameter(ParameterSetName='UseShellExecute')]
    [ValidateNotNullOrEmpty()]
    [System.Diagnostics.ProcessWindowStyle]
    $WindowStyle,

    [Parameter(ParameterSetName='Default')]
    [Switch]
    $UseNewEnvironment   
    )    
    
    process {
        $psBoundParameters = $psBoundParameters += @{"Verb"="runas"}    
        Start-Process @psBoundParameters
    }
}
