Script to dump Local User "Group Membership" to a file.

S

skojoze

Hi Everyone-

I am struggling here. I have a Windows 2000 Server that is a document
portal for one of our external clients. All I need is a script that
can parse all Local Users (620 of them) and dump the username as well
as what groups that user belongs to. I know what groups I have on that
machine and who the members are. But the problem is that there are
several users belonging to No groups. That is the real data that i
need to find. I've worked with several scripts but they are all
DS-LDAP related. Again this is Local Security on a Windows 2000 Svr.

Thanks Much.

Scott
 
D

Dave Patrick

You'll probably find something here.

http://www.rlmueller.net/products.htm


--

Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

| Hi Everyone-
|
| I am struggling here. I have a Windows 2000 Server that is a document
| portal for one of our external clients. All I need is a script that
| can parse all Local Users (620 of them) and dump the username as well
| as what groups that user belongs to. I know what groups I have on that
| machine and who the members are. But the problem is that there are
| several users belonging to No groups. That is the real data that i
| need to find. I've worked with several scripts but they are all
| DS-LDAP related. Again this is Local Security on a Windows 2000 Svr.
|
| Thanks Much.
|
| Scott
|
 
P

Pegasus \(MVP\)

Hi Everyone-

I am struggling here. I have a Windows 2000 Server that is a document
portal for one of our external clients. All I need is a script that
can parse all Local Users (620 of them) and dump the username as well
as what groups that user belongs to. I know what groups I have on that
machine and who the members are. But the problem is that there are
several users belonging to No groups. That is the real data that i
need to find. I've worked with several scripts but they are all
DS-LDAP related. Again this is Local Security on a Windows 2000 Svr.

Thanks Much.

Scott

Try this batch file:

@echo off
setlocal enabledelayedexpansion

echo Group list compiled on %date% at %time:~0,5% > c:\Groups.txt
echo ------------------------------------------ >> c:\Groups.txt
net user /domain | more +6 | find /i /v "completed successfully" >users.tmp

for /F "tokens=*" %%* in (users.tmp) do (
set line=%%*
call :ListUser !line:~0,24!
call :ListUser !line:~25,24!
call :ListUser !line:~50,24!
)
del users.tmp
endlocal
echo A list of all group memberships is now stored in c:\Groups.txt.
goto :eof


:ListUser
set user=%1
:Next
shift
if "%1"=="" goto Groups
set User=%User% %1
goto Next

:Groups
echo Processing user %User%
echo User=%User% >> c:\Groups.txt
net user "%User%" /domain | find "*" >> c:\Groups.txt
echo. >> c:\Groups.txt
 

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