Sometimes a test needs to run a process as a different user (not the logged in user executing Rapise). It is not possible to use runas command for this purpose because it forces a user to type a password manually. From this short article you will learn how to reach the goal.
Download and unpack PsTools. This is a set of tools developed by Microsoft for solving various system tasks in Windows OS. Let's assume you put the files into
PsTools contain psexec program which is capable of running tasks on any remote system and it accepts user credentials right in the command line. Here is a simple code snippet that illustrates how to use psexec with Rapise:
var userName = "usr1";
var password = "pwd";
var cmdLine = 'c:\\System\\PsTools\\psexec.exe -u "' + userName + '" -p "' + password + '" -w "' + Global.GetCurrentDir() + '" gpresult /user squirrel /h result.html';
It produces the result inside a test folder.