process - C# Processes on Remote Machine -


i wrote monitoring service keeps track of set of processes, , notifies when service acting strange, running on high memory usage, exceeding cpu runtime etc.

this working fine 1 local computer, need point remote machines , process information on these machines.

my approach, working on local:

process.getprocesses().tolist().foreach(p => myprocesses.add(p)); 

this gives me collection of processes on machine, there lot more logic (filtering processes name etc), comes down to.

what need:

process.getprocesses(machinename).tolist().foreach(p => myprocesses.add(p)); 

this complains access, question how can pass credentials somehow use functionality?

note: have of machinenames , credentials needed access these processes, need supply in config file. can run service in specified username, still complains access.

you need getprocesses(string) overload accepts target machine name, eg:

process[] remoteall = process.getprocesses("mycomputer"); 

from documentation example, see getprocessby methods have overloads accept target name.

under hood, process class uses wmi access management information list of processes.

for advanced scenarios better , faster create wmi query return data need, database, instead of enumerating remote process , extracting data each one.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -