Invoke-ScriptAs
Invoke-ScriptAs
Call external script as another user (like the Start-ProgramAs command). Note that this command requires Windows Vista or later.
Settings:
- Script file
Input of a script file with path, variables are allowed. Use the "..." button to select an existing file (on the packaging system) or enter the path manually. Please enter the external script that should be processed by a script engine. The script engine recognizes the language of the external script by the file extension: - VB-Script (Visual Basic Script). Extension: .VBS
- JScript (extended JavaScript). Extension: .JS
- Perl Script. Extension: .PL
- PowerShell Script. Extension: .PS1
- Use 32-Bit mode on x64 computer
If the script is executed on a 64-bit operating system, the counterpart for 32-bit applications SysWOW64 can be used automatically when referring to the SYSTEM32 directory. - Execute with .NET Framework
This option appears only when the command is used to run a PowerShell script and specifies the .NET Framework Runtime version under which the script runs. - Latest
Uses the latest installed .NET Framework version. At the time of writing this documentation this is version 4.8. - v2.0
Uses .NET Framework Version 2.0 - v3.0
Uses .NET Framework Version 3.0 - v3.5
Uses .NET Framework Version 3.5 - v4.0
Uses .NET Framework Version 4.0 - Account
Specifies the credentials under which the script runs. - Use this account
This option can be used to explicitly specify the credentials with which the script is executed. - User name
The user account under which the application is to run. This is entered as USERNAME for local accounts or DOMAIN\USERNAME for domain accounts. - Password
The password of the specified account.
Note: Please note that the password for the user is only stored obfuscated in the script and can therefore possibly be determined by experienced users. It is therefore recommended, to choose one of the other options for the account. |
- Use DSM account
This option is available for compatibility reasons for imported DSM Packages and cannot be used in the Packaging PowerBench context. - Use the logged-on user
The application runs under the account of the logged in user. - Use the local system account
The application runs under the local system account. - Do not run as administrator
If User Account Control (UAC) is enabled, Invoke-ScriptAs always executes the specified script as administrator by default, unless this option is activated, e.g. if a certain website is called and you want to prevent this from happening with administrative rights for security reasons. - Logon
If you want the script to run under a defined user account, this option determines how the account profile is handled. - Logon without profile
The user profile is not loaded. No changes are written to the user profile after the script is executed. - Logon with profile
The user profile is loaded; changes are written to the user profile. - Logon with network only
The script itself is executed in the context of the current user account. The specified user account is only used for network access, i.e. a logon session is opened under the specified user account.
Example:
The example below calls the PowerShell script using the local system account.
Corresponds to DSM eScript command:
- CallScriptAs
See also: