/    Sign up×
Community /Pin to ProfileBookmark

How to retrive all user names from user domain?.

Hi, I am trying to get the system domain all users name. But I unable to get the all user name except domain login user name. I used the below code. What I want to do to get the all user name from system domain. Kindly any one help me.

Properties envVars = new Properties();
Runtime r = Runtime.getRuntime();
String OS = System.getProperty(“os.name”).toLowerCase();

if ((OS.indexOf(“nt”) > -1) || (OS.indexOf(“windows 2000”) > -1 ) || (OS.indexOf(“windows xp”) > -1) )
{
p = r.exec( “cmd.exe /c set” );
}

BufferedReader br = new BufferedReader ( new InputStreamReader( p.getInputStream() ) );
String line;
while( (line = br.readLine()) != null )
{
int idx = line.indexOf( ‘=’ );
String key = line.substring( 0, idx );
String value = line.substring( idx+1 );
envVars.setProperty( key, value );
}

String domainDNSName = envVars.getProperty(“USERDNSDOMAIN”);
String userName = envVars.getProperty(“USERNAME”);

So, I need to get all users name from the domain(user domain). How to get this. Help me.

Thanks & Regards
Palani

to post a comment
Java

0Be the first to comment 😎

×

Success!

Help @Palani spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...