PackageDeployment Module Help

Package Deployment Module

Invoke-ScriptAs Cmdlet

Version 4.0.0.5

Invoke-ScriptAs

Synopsis

Run Windows script as different user

Syntax

Invoke-ScriptAs [-ScriptPath] <String> [[-CLRVersion] <String>] [[-RunAs] <String>] [-ContinueOnError] [-LeastPrivilege] [-Wow64] [[-UserName] <String>] [[-Password] <String>] [[-Logon] <String>] [[-Context] <String>] [<CommonParameters>]

Description

Run Windows script as different user.

Parameters

-CLRVersion <String>

.NET Framework version.

Required

False

Position

1

Accepts pipeline input

False

-Context <String>

User: Execution under user account; logging in HKEY_CURRENT_USER, i.e. for the user.
UserPerService: User-related command, execution in Service context.
Computer: Execution under user account; logging in HKEY_CURRENT_MACHINE, i.e. for the computer.
ComputerPerService: Execution in service context; logging in HKEY_LOCAL_MACHINE, i.e. for the computer.

Required

False

Position

6

Accepts pipeline input

False

-ContinueOnError <SwitchParameter>

Continues script execution in spite of errors in the respective command

Required

False

Position

Named

Accepts pipeline input

False

-LeastPrivilege <SwitchParameter>

With the User Account Control (UAC) activated, RunAsEx always executes the application as an administrator, unless this option is enabled.
Activating this option can be useful, for example, if a certain website is to be opened and you want to prevent that this happens with administrator privileges.

Required

False

Position

Named

Accepts pipeline input

False

-Logon <String>

NoProfile: The user profile is not loaded. No changes are written into the user profile after the application has been executed.
LoadProfile: The user profile is loaded. Changes are written into the user profile.
NetworkOnly: The application is executed using the current user account. The specified user account will only be used for access to the network, i.e. a logon session is opened under the specified user account.

Required

False

Position

5

Accepts pipeline input

False

-Password <String>

The password for the selected user account

Required

False

Position

4

Accepts pipeline input

False

-RunAs <String>

UserName: The application is executed using the account information entered.
LocalSystem: The application is executed using one of the configured DSM accounts. The account will be automatically determined according to the following rules:
If the option Log on for network only is selected (see below), the User Account for Depot Access will be used. If this account is not configured, the logged-in user's account is used instead.
In all other cases, the user account for the DSM Runtime Service will be used. If this account is not configured, the account is used instead under which the ServiceInstaller is running..
CurrentUser: The application is executed under the account of the currently logged-on user.
If this option is used in the context of the Service (i.e. a DSM service account is currently logged on), the execution is different from the interactive logon via the option Use DSM account: When running in the context of the Service the user always has full rights, while an interactive logon is controlled by the User Account Control (UAC).
LocalSystem: The application is executed under the local system account.

Required

False

Position

2

Accepts pipeline input

False

-ScriptPath <String>

Please enter the name of the script file you want to run through a scripting engine. The Installer recognizes the scripting language used by its file extension: VB Script (Visual Basic Script *.vbs), JScript (extended JavaScript *.js), Perl Script (*.pl), PowerShell (*.ps1).

Required

True

Position

0

Accepts pipeline input

False

-UserName <String>

The user account under which the application is to be executed.
Data can be input as follows: <Username> , <Domain>\<Username>

Required

False

Position

3

Accepts pipeline input

False

-Wow64 <SwitchParameter>

By default, the PackageDeployment module assumes to run in a 64-bit PowerShell process on 64-bit systems, and therefore defaults to the 64-bit application location (if different from the 32-bit application location) for file and registry accesses. If you want to access the 32-bit counterparts (in the file system %WinDir%\SysWOW64 instead of %WinDir%\System32, in the registry HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node instead of HKEY_LOCAL_MACHINE\SOFTWARE), use the -Wow64 switch.

Required

False

Position

Named

Accepts pipeline input

False

<CommonParameters>

For more information about common parameters, type "Get-Help about_CommonParameters".