Initialise a set of user credentials to use during Run and RunWait operations. 2000/XP or later ONLY.
RunAsSet ["user", "domain", "password"] [, options]
Parameters
username | The user name to use. |
domain | The domain name to use. |
password | The password to use. |
options | [optional] 0 = do not load the user profile, 1 = (default) load the user profile, 2 = use for net credentials only |
Return Value
Returns 0 if the operating system does not support this function.
Remarks
This function allows subsequent Run and RunWait functions to run as a different user (e.g. Administrator). The function only works on the 2000/XP (or later) platforms. NT4 users should install and use the SU command from the NT Resource Kit.
Related
RunAsSet, RunWait
Example
Set oAutoIt = WScript.CreateObject("AutoItX3.Control")
' Set the RunAs parameters to use local adminstrator account
oAutoIt.RunAsSet "Administrator", "MyDom", "adminpassword"
' Run registry editor as admin
oAutoIt.RunWait "regedit.exe"
' Reset user's permissions
oAutoIt.RunAsSet