I wrote a monitoring service that keeps track of a set of processes, and notifies when the service is acting strange, running on high memory usage, exceeding CPU runtime etc.
This is working fine one my local computer, but I need it to point to remote machines and get the Process Information on these machines.
My approach, working on Local:
Process.GetProcesses().ToList().ForEach(p => MyProcesses.Add(p));
This gives me a collection of Processes on my machine, there is a lot more logic to it (filtering processes by name etc), but this is what it comes down to.
What I need:
Process.GetProcesses(machineName).ToList().ForEach(p => MyProcesses.Add(p));
This obviously complains about Access, the question is how can I pass credentials to somehow use this functionality?
Note: I have all of the machineNames and credentials needed to access these processes, but I need to supply this in a config file. I can run the Service in the specified username, but it still complains about access.