Question I want to embed administration capabilities into a WiseScript and need to use the the RunAs command. How can I implement the RunAs Command in Wisescript?
User rights can cause headaches for the installation developer. For example, you are writing an installation for an application that consists of:
Several application files to be installed to an application directory.
A system file to be installed to th System32 directory.
Several HKEY_CURRENT_USER registry keys containing configuration information.
This causes problems since the installation writes a file to the System32 folder, which is locked down for non-administrator users. To complete the installation, you can do one of the following:
Require an administrator install the application. While this places the file in the System32 folder, the registry keys install with the administrator's profile rather than the end users.
Split the install into a per-computer and per-user installation. This creates two installations to track and requires the administrator to run each per-computer installation and each user to run the per-user installation.
Create one installation that runs in a rights-elevated state. The installation accesses the System32 folder by running part of the installation as a different user.
To implement the third option, elevate security rights of the installation by using either:
RUNAS (Windows 2000 and later) SU (Windows NT 4)
This simple command line utility lets an external process execute with the rights of the username passed on the command line. This places the per-computer portions of the installation in a silent WiseScript that executes as part of the main installation. Running this command results in a single-user .exe that modifies both per-computer and per-user sections of the registry correctly.
To use the command line utility:
Open Wise Installation System or WiseScript Editor in Wise Package Studio.
In Setup Editor, select the beginning of the per-computer portion of the script.
Double-click Execute Program in the Actions list. The Execute Program Setting dialog appears.
UserID is the user who runs the application and domain is the domain or computer name where the user resides.
Because the RUNAS command does not pass a password on the command line, do not select Hidden from Window Size if a password is needed to execute the installation. Sanur, a free utility, lets you pipe a password to RUNAS so the installing user does not have to enter in an administrator password at runtime.
By using a command line utility, you can create clean, easy-to-run installations for all users.
Imported Document ID: HOWTO6969
Subscribing will provide email updates when this Article is updated. Login is required.