Get the list of logged on machines in a domain from within that domain

E

Eranga

I want to get the list of computers with users logged on in my domain
using C# as the language .
Can some one of you plese tell me how exactly I can perform this
Thanks in advance
 
A

Angel J. Hernández M.

Hi there... One easy solution can be

net view > c:\loggedon.txt

at the command prompt and then manipulate the text file any way you want

Regards,
 
E

Eranga

Hello Angel,
Thanks for your reply. But I want to use this in a program and feed the
results in to an asp.net web application. Do you think the net view can
be used in that sense.?
Thanks in advance for any helpful comments and tips.
 
W

Willy Denoyette [MVP]

Angel J. Hernández M. said:
Hi there... One easy solution can be

net view > c:\loggedon.txt

at the command prompt and then manipulate the text file any way you want

Regards,


--
Angel J. Hernández M.
MCP - MCAD - MCSD - MCDBA
http://groups.msn.com/desarrolladoresmiranda
http://www.consein.com

Note that this returns the computers on the network that have their
"Netbios" name broadcasted, that doesn't mean there are currently inteactive
users logged on as asked by OP.

Willy.
 
W

Willy Denoyette [MVP]

Eranga said:
Hello Angel,
Thanks for your reply. But I want to use this in a program and feed the
results in to an asp.net web application. Do you think the net view can
be used in that sense.?
Thanks in advance for any helpful comments and tips.

Unless you are running in a domain (be it NT4 or AD), there is no easy way
to know the machines that have users logged on.
If you have a domain infrastructure, you can use System.DirectoryServices to
query the machine names in the domain, when you have a list of machines you
can use System.Management and WMI to query the logon sessions running on
each box individually.

Willy.
 
E

Eranga

Thanks for your help
Yes I am workin in the domain it self. I want to get the machines with
users logged on in this domain.what is the method you thought of when
you wrote
"Unless you are running in a domain (be it NT4 or AD), there is no easy
way
to know the machines that have users logged on."
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top