Good day.
This is the code in my function:
int num, ret, i
long pid
String ls_query, ls_name
Any process
ls_query = 'select * from Win32_Process where name = "appname.exe"'
locator = CREATE OleObject
ret = locator.ConnectToNewObject("WbemScripting.SWbemLocator");
service = locator.ConnectServer();
props = service.ExecQuery(ls_query);
num = props.count()
pid = props.processid
Messagebox("of_check_sp_running", "count = "+ string(num) + " and pid = "+ string(pid))
return num
num comes back with 0 if appname.exe is not running and > 0 when one or more appname.exes are running.
But I'm looking to get the processid, but it keeps crashing.
Googled and have not found anything that works.
My goal is to download a self extracting install app that will update the current running app.
So, if app123_servicepack.exe is running (because I just downloaded it from a website from appname.exe), terminate appname.exe using similar script above prior to clicking install on app123_servicepack.exe. I terminate using name in win32_processes, but it kills appname.exe and app123_servicepack.exe as well.
I'm thinking I can terminate appname.exe by the processid and it will hopefully not terminate app123_servicepack.exe as well.
Thanks for any help anyone can provide.
I downloaded this module a couple of years back and incorporated it into my app. I modified it to pull the updated software from a table in an Oracle database. Worked great on Windows 7. When our users began migrating to Windows 10, running a vbscript was not allowed and our desktop team was not willing to change that. So I made another modification where it downloads a self extracting installation executable which users are allowed to run. This worked for a while until something changed, a windows update, or a policy somewhere, but when my app calls the self extracting installation exe, it prompts for an administrator password. Yet, the user has permission to run that install app from the downloaded folder, the application does not.
It was suggested by our desktop team to run this command prior to running the install app
(set __COMPAT_LAYER=RunAsInvoker)
I hadn't been too successful getting this to work.