Windows Unattended installation - run script as specific user

474 views Asked by At

I am developing Windows installation on a local computer with unattended answer file and use setup.exe. In the unattended.xml I am adding a user X with a password. I want to add a script to the installation. The script does cipher to my files in a specific folder c:\cipherfiles, and I want to run that command under user X (that user X will have the certificate for this folder).

running it using SetupComplete.cmd, LogonCommands\AsynchronousCommand, Microsoft-Windows-Setup\RunAsynchronousCommand or RunSynchronousCommand didn't work.

any idea how should I do it ? Thanks

1

There are 1 answers

0
Jorge Ibáñez On

Ain't a job for "RUNAS" ?

runas /user:$username <program>

or

runas /user:$username@$domain <program>

I think including this on your SetupComplete.cmd would be enough.