lparameters tcComputer, tcProcess local lcComputer, loWMIService, loProcess, loProcesses, lcProcess lcComputer = Iif(Vartype(tcComputer) = 'C' and not Empty(tcComputer), tcComputer, '.') lcProcess = Iif(Vartype(tcProcess) = 'C', tcProcess, '') loWMIService = GetObject("winmgmts://" + lcComputer + "/root/cimv2") loProcesses = loWMIService.ExecQuery("SELECT * FROM Win32_Process" + Iif(Empty(lcProcess), "", " Where Name = '" + lcProcess + "'")) clear For Each loProcess in loProcesses with loProcess ? .Name, .ExecutablePath, .caption, .commandline, Ctot(Transform(.CreationDate, '@R 9999-99-99T99:99:9999')) endwith NextFor example if you want to know if VFP8.EXE is running, you call
do with '.', 'Vfp8.EXE'Where '.' is the local computer, you can remove this parameter alltogether, because you'll need to have rights on the remote computer to run WMI