Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Get Process Info Form Remote Computer
Message
 
To
11/01/2008 13:05:43
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01281190
Message ID:
01281219
Views:
7
Steven,

If you can use WSH and WMI, and you have enough rights (in the example I'll show you; you need domain administrator rights, with other rights it becomes more complicated) then you can use something like this, which will show all the processes running in the local computer or in a remote computer (for local computer you do not need special rights) (if you want to know about just a particular process you pass a second parameter
lparameters tcComputer, tcProcess
local lcComputer, loWMI, loProcess, loProcesses, lcProcess, loLocator

lcComputer			= Iif(Vartype(tcComputer) = 'C' and not Empty(tcComputer), tcComputer, '.')
lcProcess			= Iif(Vartype(tcProcess) = 'C', tcProcess, '')
loLocator			= CREATEOBJECT('WBEMScripting.SWBEMLocator')
loWMI				= loLocator.ConnectServer(lcComputer)
loProcesses			= loWMI.ExecQuery("SELECT * FROM Win32_Process" + Iif(Empty(lcProcess), "", " Where Name = '" + lcProcess + "'"))
clear
For Each loProcess in loProcesses
	with loProcess
		? .ProcessID, .Name, .ExecutablePath, .caption, .commandline, Ctot(Transform(.CreationDate, '@R 9999-99-99T99:99:9999'))
	endwith
Next
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform