Connecting Tech Pros Worldwide
Ph: 10152430
 
 
sign in | join about | help | sitemap
[ http://bytes.com/adLoader.php?parent=programming
balach's Avatar

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


Question posted by: balach (Newbie) on September 18th, 2008 06:05 AM
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,


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.

regards i more specify my questin that, i have IP address 10.15.24.10 and the IP of my friend is 10.15.24.30, 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.
post reply
Quote | Subscribe
11 Answers Posted
DeepBlue's Avatar
Expert - 187 Posts
#2: Re: i want to get memory usage of client through IP address.

take a look at this thread:
thread

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

Expand|Select|Wrap|Line Numbers
ConnectionOptions con = new ConnectionOptions();               con.Username = "";             con.Password = "";               ManagementScope scope = new ManagementScope(             "\\\\ComputerName\\root\\cimv2", con);             scope.Connect();               ObjectQuery que = new ObjectQuery(             "SELECT * FROM Win32_OperatingSystem");               ManagementObjectSearcher searcher =              new ManagementObjectSearcher(scope,que);                 ManagementObjectCollection querys = searcher.Get();               foreach (ManagementObject m in querys)               {                 string s = Convert.ToString(m["FreePhysicalMemory"]).Trim();                 s = Convert.ToString(m["FreeVirtualMemory"]).Trim();                 s = Convert.ToString(m["TotalVirtualMemorySize"]).Trim();                 s = Convert.ToString(m["TotalVisibleMemorySize"]).Trim();               }    
DeepBlue's Avatar
Expert - 187 Posts
#3: Re: i want to get memory usage of client through IP address.

Do add a reference to System.Management;

For more info google : WMI (windows management instrumentation)
Also look for a wmi tool in msdn...
balach's Avatar
Newbie - 11 Posts
#4: Re: i want to get memory usage of client through IP address.



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

Expand|Select|Wrap|Line Numbers
  ConnectionOptions con = new ConnectionOptions();  con.Username = "";  con.Password = "";    ManagementScope scope = new ManagementScope( "\\\\10.15.24.30\\root\\cimv2", con);    //Here comes error on executing below line, that RPC server is not responding   scope.Connect(); 


regardsthanks alot ''Dirtbag" for answer but, when i give the IP address(10.15.24.30) 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.
Plater's Avatar
Moderator - 5,956 Posts
#5: Re: i want to get memory usage of client through IP address.

Quote:
Originally Posted by balach
when i give the IP address(10.15.24.30) 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)
jg007's Avatar
Familiar Sight - 243 Posts
#6: Re: i want to get memory usage of client through IP address.

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.
balach's Avatar
Newbie - 11 Posts
#7: Re: i want to get memory usage of client through IP address.

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
scope.Connect();

i request for some other possible issues that i must check regarding this problem.
jg007's Avatar
Familiar Sight - 243 Posts
#8: Re: i want to get memory usage of client through IP address.

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-

\\<IP ADDRESS>\c$
Plater's Avatar
Moderator - 5,956 Posts
#9: Re: i want to get memory usage of client through IP address.

I would guess that one or BOTH of you have the RPC services turned off then?
There is
Remote Procedure Call (RPC)
and
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
DeepBlue's Avatar
Expert - 187 Posts
#10: Re: i want to get memory usage of client through IP address.

check this out
MSDN
See This too
see

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

"Remote Procedure Call (RPC)
and
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...
balach's Avatar
Newbie - 11 Posts
#11: Re: i want to get memory usage of client through IP address.

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.
GOD BLESS ALL OF YOU
jg007's Avatar
Familiar Sight - 243 Posts
#12: Re: i want to get memory usage of client through IP address.

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
Reply
Not the answer you were looking for? Post your question . . .
196,231 members ready to help you find a solution.
Join Bytes.com

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 196,231 network members.
Post your question now . . .
It's fast and it's free

Popular Articles

Top .NET Contributors

[ http://bytes.com/adLoader.php?parent=programming


You are viewing a mobilized version of this site...
View original page here

How do you rate mobile version of this page?

Mobilized by Mowser Mowser