How list all domain users and save result to a file

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi Folks:
I need to get a list of all our domain users and save it to a file. I
know that the net user command works but I need to also include each users
display name. Thanks.
 
Hello TJ,

You can export the users list in to .TXT file using AD users and computers
snap in.

Open AD users and computers snap in->Click on users folder->click on action
menu->select export file->save the file.

CLick on view menu-> choose columns->Add Display name. // This is used
to list the display name

Thanks,
(e-mail address removed)

This posting is provided "AS IS" with no warranties, and confers no rights.
 
i have a bunch of OUs and I want to view all in one screen instead of going
into each subfolders and export to a file. Do this will generate more than
one file. I want all in just a single file. Would your suggestion work?
 
TJ said:
Hi Folks:
I need to get a list of all our domain users and save it to a file. I
know that the net user command works but I need to also include each users
display name. Thanks.

Try this batch file:

@echo off
if exist "%temp%\users.2" del "%temp%\users.2"
if exist "%temp%\details.txt" del "%temp%\details.txt"


net user | more +4 | find /i /v "successfully" > "%temp%\users.1"

for /F "tokens=1" %%n in ("%temp%\users.1") do echo %%n>>"%temp%\users.2"
for /F "tokens=2" %%n in ("%temp%\users.1") do echo %%n>>"%temp%\users.2"
for /F "tokens=3" %%n in ("%temp%\users.1") do echo %%n>>"%temp%\users.2"

type "%temp%\users.2" | sort > "%temp%\users.txt"
for /F %%a in ("%temp%\users.txt") do net user >> "%temp%\details.txt"
 
Try this batch file:

@echo off
if exist "%temp%\users.2" del "%temp%\users.2"
if exist "%temp%\details.txt" del "%temp%\details.txt"


net user | more +4 | find /i /v "successfully" > "%temp%\users.1"

for /F "tokens=1" %%n in ("%temp%\users.1") do echo
%%n>>"%temp%\users.2" for /F "tokens=2" %%n in ("%temp%\users.1") do
echo %%n>>"%temp%\users.2" for /F "tokens=3" %%n in ("%temp%\users.1")
do echo %%n>>"%temp%\users.2"

type "%temp%\users.2" | sort > "%temp%\users.txt"
for /F %%a in ("%temp%\users.txt") do net user >> "%temp%\details.txt"

nice~

happy new year
 

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

Back
Top