1

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
Mofi
  • 46,139
  • 17
  • 80
  • 143
Troy
  • 11
  • 3
  • Was execution of DriverProgram.exe from `different user` successfull? I would create scheduled work (with Task Scheduler) under security context of the `different user`. Give current user [permission to run scheduled work](https://serverfault.com/questions/810371/) or [permission to run service](https://stackoverflow.com/questions/4436558/). – Daemon-5 Jan 21 '22 at 03:50
  • Yes it does execute under the other user, but then crashes. I have also tried creating a task in Task Scheduler, and running the program directly as the different user (bypassing the .bat file altogether) and I get the same result, without the error message. – Troy Jan 24 '22 at 06:59

0 Answers0