I need to restart an application using a service running on the SYSTEM account. The problem is that the application is then also started under the SYSTEM account. For various reasons beyond my control the restart system is a bit complicated but as a result of its complicatedness(c) I'm sure there must be at least one stage where its possible to specify the account that the app is eventually run on.
The service calls bounce.bat which contains the following:
@echo off
cscript "C:\Program Files\myApp\bounce.vbs"
The relevant section of bounce.vbs is:
Set oProcess = oWMIService.Get("Win32_Process")
Set oProgram = oProcess.Methods_("Create").InParameters.SpawnInstance_
oProgram.CommandLine = sPath & sExe
Set sShell = oWMIService.ExecMethod("Win32_Process", "Create", oProgram)
If there are no clever suggestions I'll try this approach, but I'm sure there must be a cleaner way.
Note: Cross-posted from SO as the original was getting no action.