Core Function RunAsSet
From Sputnik Wiki
RunAsSet( <user>, <domain>, <password>, <options> )
Contents |
Description
Initialise a set of user credentials to use during Run and RunWait operations.
Parameters
username
Optional; The user name to use.
domain
Optional; The domain name to use.
password
Optional; The password to use.
options
Optional;
0 = do not load the user profile
1 = (default) load the user profile
Return Value
Returns 1--regardless of success. (If the login information was invalid, subsequent Run/RunWait commands will fail....)
Remarks
This function allows subsequent Run and RunWait functions to run as a different user (e.g. Administrator).
The "Secondary Logon service" or "RunAs service" must not be disabled if you want this function to work.
To unset the RunAs details, use the function with no parameters: RunAsSet().
Example
// Set the RunAs parameters to use local adminstrator account RunAsSet("Administrator", @DOMAIN, "adminpassword"); // Run registry editor as admin RunWait("regedit.exe"); // Reset user's permissions RunAsSet();