Kill process, restart and run under different user

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
timle
Pro Scripter
Posts: 96
Joined: Tue Apr 20, 2004 5:53 am

Kill process, restart and run under different user

Post by timle » Wed Jan 31, 2007 7:04 pm

HI
I have a server that run Disstiller in the background, when the program hungup, I have to kill the process "acrodist.exe" but when I restarted, it runs under the current user login. Is there a way to restart the process under a specific user account?

Thank you

This script below is from one of the forum, but it did not have a restart process part.

VBSTART
Sub killProcess(pgm)
set wmi = getobject("winmgmts:")
sQuery = "select * from win32_process " & "where name='" & pgm & "'"
set processes = wmi.execquery(sQuery)
for each process in processes
process.terminate
next
End Sub
VBEND

VBRun>KillProcess,AcroRd32.exe

User avatar
JRL
Automation Wizard
Posts: 3532
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Thu Feb 01, 2007 1:51 pm

Try using the DOS "runas" command. For instruction on how to use runas, open a DOS window and type runas /?. Use the Macro Scheduler Run Program> function to run a DOS command. A quick sample would be:

Run Program>cmd /c runas [parameters]

See Macro Scheduler help for proper use of Run Program>.

Search the forum for "DOS" or "cmd" to see many examples for running DOS commands from Macro Scheduler scripts.

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts