Run tasks of a script with different user privileges or allow to run a script within another script
Run tasks of a script with different user privileges or allow to run a script within another script. Problem is that I often need to install software and deploy settings to the %appdata% folder of the current logged-in user.
I accomplish this in this way:
The script runs as logged in user;
I run a batch script that runs a program named CPAU.exe with a xx.job file that contains the user ID & password to "run as" along with what to run as said user..
(info about CPAU.exe is here: http://www.joeware.net/freetools/tools/cpau/usage.htm)
Then I have another task that runs a batch to configure whatever is needed from the logged in user context.
I was able to do this with other software distribution products.
Run the installation or change as local system/administrator and then in the same script apply registry keys or %appdata% folder changes or a configuration change or just launch the program and have that run as the currently logged in user.
This makes the scripts so much more flexible.