C# Query a remote computer for resource usage (i.e. cpu load, ram usage)
Is there some simple way to send out a ping-style message to a remote PC and get back some general facts/figures about the PC in C#? I'd be mostly interested in CPU Load, RAM usage, current running processes, etc. but the more information the merrier (extra info like CPU specs would be cool)!
I imagine in an ideal situation it'd be as sim开发者_如何学Gople as pinging a computer, via a simple 3rd party library. I can run custom apps on the remote computers, but it would be awesome if it just worked out of the box.
Yes you can. With WMI. You can read more about it here: http://en.wikipedia.org/wiki/Windows_Management_Instrumentation
It allows you to send queries to any remote computer you have access to and retrieve a multitude of information
Edit: It might not exactly be as easy as sending a ping request, but when you get the hang of it, it feels very natural.
There is a few options...
You can do a simple ping from System.Net.NetworkInformation.Ping ( http://msdn.microsoft.com/en-us/library/system.net.networkinformation.ping.aspx ), and as stated above there is the possibility of using WMI ( http://msdn.microsoft.com/en-us/library/bb404655.aspx ).
You can also checkout other sites for some plain startup code... ( http://www.csharphelp.com/archives2/archive334.html )
精彩评论