Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Restart an aplication on remote computer

Status
Not open for further replies.

kadara

Programmer
Mar 2, 2012
26
DE
Hi,
I have a running application (whatever.exe) on a remote computer. That executable sometimes not working properly and need to be relunch it. How could I restart this executable on that computer?
 
Forcefully:

Code:
strComputer = "computer_name"
strProcess = "file.exe"
set colProcesses = GetObject("winmgmts:\\" & strComputer & "\root\cimv2").ExecQuery("Select * from Win32_Process Where Name='" & strProcess & "'")
if colProcesses.count <> 0 then
	for each objProcess in colProcesses
		objProcess.Terminate()
	next
end if

set objShell = Wscript.CreateObject("wscript.shell")
objShell.Run "c:\path\to\file.exe"

Gracefully? ... I would guess AppAtivate and sendkeys, but this is rather tedious, imo.

-Geates

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top