You need an external way to execute commands using privileges from another user. Windows command RunAS
will allow that, but you’ll need to input the password for that user “interactively”, so this not useful for automating anything. Therefore, you’ll need to use another tool able to execute something passing as user and password parameters in the command line. CPAU, a freeware tool, does exactly that. You can get it from here:
http://www.joeware.net/freetools/tools/cpau/index.htm
Basic use:
CPAU -u user [-p password] -ex "WhatToRun" [switches]
user User to log on as. Ex: user or domain\user password User's password WhatToRun What to execute
There’s another tool with more options to encrypt the password, and with more security options, for avoid putting a password on the .conf
file an it let more cipher options. This tool is called RunAsSSPC, and you can get it from here:
http://robotronic.de/runasspcEn.html