468,107 Members | 1,547 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,107 developers. It's quick & easy.

i want to get memory usage of client through IP address.

hi all;

i am new in .NET and i am assigned work like this.

my question is that, 3 clients are connected wtih server on LAN, i want to get the cpu usage and physical memory usage of one client on another client,
i more specify my questin that, i have IP address and the IP of my friend is, from my system i just pass IP Address of my friend's system and i get cpu usage and physical memory usage of my friend.

please tell me is it possible by using any method ?? and please also demonstrate in little detail what process should i follow, this problem will be solved by using desktop application or web based app.

please............... give me idea about its development.

Sep 18 '08 #1
11 9842
750 Expert 512MB
take a look at this thread:

For remote computers you need to supply username and password along with IP/computername

Expand|Select|Wrap|Line Numbers
  1. ConnectionOptions con = new ConnectionOptions();
  3.             con.Username = "";
  4.             con.Password = "";
  6.             ManagementScope scope = new ManagementScope(
  7.             "\\\\ComputerName\\root\\cimv2", con);
  8.             scope.Connect();
  10.             ObjectQuery que = new ObjectQuery(
  11.             "SELECT * FROM Win32_OperatingSystem");
  13.             ManagementObjectSearcher searcher = 
  14.             new ManagementObjectSearcher(scope,que);
  17.             ManagementObjectCollection querys = searcher.Get();
  19.             foreach (ManagementObject m in querys)
  21.             {
  22.                 string s = Convert.ToString(m["FreePhysicalMemory"]).Trim();
  23.                 s = Convert.ToString(m["FreeVirtualMemory"]).Trim();
  24.                 s = Convert.ToString(m["TotalVirtualMemorySize"]).Trim();
  25.                 s = Convert.ToString(m["TotalVisibleMemorySize"]).Trim();
  27.             }
Sep 18 '08 #2
750 Expert 512MB
Do add a reference to System.Management;

For more info google : WMI (windows management instrumentation)
Also look for a wmi tool in msdn...
Sep 18 '08 #3
thanks alot ''Dirtbag" for answer but, when i give the IP address( of my friend's computer in "management scope" as like in code below to check my friend's memory usage at that specific time, then it gives error that" RPC server is not connected or not responding" i think that it is an exception that is fired, and i am unaware to handle this exception to fulfil my requirement that is named as the title of this thread.

i shall be thankful if you could resolve this problem, or any other forum member who could help me.

Expand|Select|Wrap|Line Numbers
  2. ConnectionOptions con = new ConnectionOptions(); 
  3. con.Username = ""; 
  4. con.Password = ""; 
  6. ManagementScope scope = new ManagementScope( "\\\\\\root\\cimv2", con); 
  8. //Here comes error on executing below line, that RPC server is not responding
  10. scope.Connect(); 
Sep 26 '08 #4
7,872 Expert 4TB
when i give the IP address( of my friend's computer in "management scope" as like in code below to check my friend's memory usage at that specific time, then it gives error that" RPC server is not connected or not responding"
WMI calls are blocked by firewalls in general (security), so if your friend is on another network, or is otherwise blocked by a firewall, you will not be able to make the connection. You also need to be able to supply valid user credentials to get into the system, and the user must have rights to use WMI on the system.

I would look up the WMICodeCreator tool, it's pretty helpfull in building WMI calls (it will write code for you)
Sep 26 '08 #5
283 100+
you will need to also have admin access the other PC and access to the RPC share and , to check if you have access try connecting to the other computer using computer managment and see it that works

( right click 'my computer' , select manager , click on 'action ' then connect to another computer .

also it is not something that is easy to do using XP home and really needs you to have XP Pro so that you can set up the permissions okay

also look at hamatchi if your friends pc is not on the same network as you.
Sep 26 '08 #6
thanks for answers, but unfortunately problem is still there, i have checked all of the scenarios delivered by "jg007" and "plater" with this additional scenario, as given at this url

Even this url has also not solved my problem

my program is still giving this error "The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)"
this error is generated on this line of code

i request for some other possible issues that i must check regarding this problem.
Sep 27 '08 #7
283 100+
please can you advise what happens when you try to connect using computer manager and also if you are able to connect to the other pc by accessing the c$ share on it

to access C$ share go to run and enter below replacing the ip add bit with whatever the remote machine is-

Sep 27 '08 #8
7,872 Expert 4TB
I would guess that one or BOTH of you have the RPC services turned off then?
There is
Remote Procedure Call (RPC)
Remote Procedure Call (RPC) Locator
services, which i think need to be running.

You should try to connect using the windows manager thing mentioned earlier and see what happens
Sep 29 '08 #9
750 Expert 512MB
check this out
See This too

As Plater pointed out u need..(especially if u are startin or stoppin services)

"Remote Procedure Call (RPC)
Remote Procedure Call (RPC) Locator
services, which i think need to be running."

ConnectionOptions con = new ConnectionOptions();
con.Username = ""; // You need to provide administrator name
con.Password = ""; // and password... cant be blank for remote PC..
Without proper username n password u wont be able to connect( also the username should have admin or wmi rights on the remote PC)...
Although WMI calls are blocked by default .... for querying information that should not be a problem...if i remember correctly i had issues tryin to shutdown remote pc... gettin remote information was OK as long as windows firewall was off...
Sep 29 '08 #10
thank you very much to all, giving me best possible cases for accessing remote system's information, but i do not wnat to do any configuration on remote system, as mentioned in the last post, sent by "DeepBlue".

here, what i desire, without doing any configuration on remote system, by using any method of c#.NET, how do i get remote System information as like CPU usage, Memory Usage of remote system.

thanks in advace for answers and coding.
Oct 11 '08 #11
283 100+
if you do not have permission to access the RPC on the other system you wil NOT be able to find out this information.

please confirm what happens when you try as above to connect to the c$ share or computer manager as this will diagnose further to see if it is just your program or if you do not have the access that you need to do what you want to do
Oct 11 '08 #12

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by Frank Esser | last post: by
9 posts views Thread by Jimmy Cerra | last post: by
7 posts views Thread by Jon Trickey | last post: by
8 posts views Thread by Grant Richard | last post: by
4 posts views Thread by =?Utf-8?B?U2FuZGVlcCBUaG9wcGls?= | last post: by
2 posts views Thread by jld | last post: by
22 posts views Thread by Peter | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.