sample code for detecting a process... - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

davidsmith
Posts: 59
Joined: Sun Jul 12, 2009 8:33 pm

sample code for detecting a process...

In the documentation, there is sample code to detect if a process is running. For this code, why is "strComputer" a variable? Am I suppose to set that to a value other than "."? See below. I changed the code for "OUTLOOK.EXE".

Dim objWMIService, objProcess, colProcess
Dim strComputer
strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colProcess = objWMIService.ExecQuery ("Select * from Win32_Process")

Session.Property("PROCESS")="NOT RUNNING"
For Each objProcess in colProcess
if objProcess.Name = "OUTLOOK.EXE" then
Session.Property("PROCESS")="RUNNING"
End If
Next
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: sample code for detecting a process...

Hi,

I'm afraid we don't debug Custom Action code.

In our latest version you can find a Predefined Custom Action called DetectProcess which does what you need.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”