Windows NT and Java.......
Hi,
I know that this topic doesn't belong to this forum but I couldn't find any other good answers.
I am working on a Windows NT WorkStation. I want to develop a program in Java which will find.....
How many uses are logged on and what is the IP addresses ( TCP/IP ) of the systems who are logged on. Is it possible in Java to find the users in Windows NT.? Please help me. Ay examples or codes will be highly helpful.
Thanks
Deepak
[479 byte] By [
Deepak_sh] at [2007-9-26 1:48:31]

One way is to make system calls using the Runtime.exec() method. Though it may be difficult to get (parse?) the information from the command's output...
String[] commandLine = new String[]{ "command", "param1", "param2" };
try
{
Process p = Runtime.getRuntime().exec(commandLine);
}
catch(IOException e)
{
e.printStackTrace();
}
p_b at 2007-6-29 2:48:54 >

using the exec method (as p_b stated) make a 'net session' call, that will list any connected users and their machines. Read the input stream from the returned process and parse.Then use java.io.net.InetAddress to get the IP addess of the machine.
Get the Inputstream from the Process object and apply a BufferedReader on it...
String[] nativeCmd = { "ntCommand", "param1", "param2" };
Process proc = Runtime.getRuntime().exec(nativeCmd);
BufferedReader bufr = new BufferedReader ( new InputStreamReader( proc.getInputStream () ) );
String s = null;
while ( (s = bufr.readLine ()) != null)
{
System.out.println(s);
}
Hope it works...
p_b at 2007-6-29 2:48:54 >
