I have a .bat file that should start a service as a different user. The different user account has administrator privileges.
Here's the kicker, when I perform Shift + Right-click on the service .exe file, it gives me the option to run as the other user, and prompts for the credentials, and the service runs.
But when I run the batch script which attempts to run the service, it prompts for the user password and then crashes immediately after it starts, and shows the message:
[programName] has stopped working. A problem ... bla bla bla... Windows will close the program and notify you when a solution is available.
The Windows event log gives me exception code: 0xe0434f4d
Fault offset: 0x0000000000033c58
Neither of which leads to anything meaningful that I could find.
I found a page where is written to remove a couple of registry files and start over. However, when I navigated to the registry files to be removed, they were not there in the first place.
Batch file code:
echo off
cd C:\[Path to my company's install directory]
runas /user:local\TestUser DriverProgram.exe