mdp2176
asked on
Scripting scheduled tasks with Run As
How does one script the creation of Windows Scheduled Task and set the Run As property of the task at the same time? I can create a scheduled task easily though vbscript, but can't for the life of me find anything that says how the Run As property can be set through code. Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
**************************
RUNAS USAGE:
RUNAS [/profile] [/env] [/netonly] /user:<UserName> program
/profile if the user's profile needs to be loaded
/env to use current environment instead of user's.
/netonly use if the credentials specified are for remote access only.
/user <UserName> should be in form USER@DOMAIN or DOMAIN\USER
program command line for EXE. See below for examples
Examples:
> runas /profile /user:mymachine\administra
> runas /profile /env /user:mydomain\admin "mmc %windir%\system32\dsa.msc"
> runas /env /user:user@domain.microsof
NOTE: Enter user's password only when prompted.
NOTE: USER@DOMAIN is not compatible with /netonly.