I have some code that I use to terminate processes, and occasionally I get an error.
The error is "Alias LoProcess can't be found" or similar
I would like to get this to run without an error if possible.
Noted is that if I get the users to reboot their windows tablets, it will run fine.
Any help would be greatly appreciated
The error is "Alias LoProcess can't be found" or similar
I would like to get this to run without an error if possible.
Noted is that if I get the users to reboot their windows tablets, it will run fine.
Any help would be greatly appreciated
Code:
LPARAMETERS lcProcess
lcFail=.f.
lcComputer = "."
loWMIService = Getobject("winmgmts:" ;
+ "{impersonationLevel=impersonate}!\\" + lcComputer + "\root\cimv2")
colProcessList = loWMIService.ExecQuery ;
("Select * from Win32_Process")
FOR EACH loProcess IN colProcessList
IF ALLTRIM(UPPER(loProcess.name)) == ALLTRIM(UPPER(lcProcess))
TRY
loProcess.terminate()
CATCH
lcFail=.t.
ENDTRY
IF lcFail=.t.
EXIT
ENDIF
ENDIF
NEXT