Link to home
Start Free TrialLog in
Avatar of bhanukbm
bhanukbm

asked on

how to export user from a usersgroup

Hi I have some local groups on my webserver and each group contains number of users in it.I would like to know is there any way I can export all the users in one group to a text file.
Avatar of oBdA
oBdA

"net.exe localgroup <groupname>" will do this for you, if you redirect the output.
The problem is that there are lots of unneeded lines included; to get rid of those, it takes a bit more.
Just give this the name aof your group as an argument, and it will produce the same output as "net localgroup", only with header and trailer stripped.

====8<----[exportlg.cmd]---------------------------------
@echo off
setlocal

set Enable=FALSE
if %1.==. goto leave

for /f "tokens=*" %%a in ('net localgroup') do set CommandCompleted=%%a

for /f "tokens=*" %%a in ('net localgroup %1') do call :process %%a
goto leave

:process
if "%1"=="-------------------------------------------------------------------------------" (
 set Enable=TRUE
 goto :eof
)
if /i %Enable%==FALSE goto :eof

if not "%*"=="%CommandCompleted%" echo %*
goto :eof

:leave
====8<----[exportlg.cmd]---------------------------------
Avatar of bhanukbm

ASKER

Thanks for the answer oBDA. I am a  developer and don't have full access to my production server. But I can see the users in the local groups of my production server through MMC from my windows 2000 professional desktop.
So is there any way that I can run some utilty from my machine to get all the users from the local groups of production box. Sorry for not being clear in my first question.
 
ASKER CERTIFIED SOLUTION
Avatar of Obi_Wannabe
Obi_Wannabe

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Please send me this tool. My email is kandulabhanu@yahoo.com