Simpler Navigation for Servers and Operating Systems - Please Update Your Bookmarks
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
If you have bookmarked forums or discussion boards in Servers and Operating Systems, we suggest you check and update them as needed.
Operating System - Microsoft
cancel
Showing results for 
Search instead for 
Did you mean: 

domain user group

SOLVED
Go to solution
T G Manikandan
Honored Contributor

domain user group

How can I find the domain groups to which domain user belongs?



found a script.Any command?

2 REPLIES
T G Manikandan
Honored Contributor

Re: domain user group

C:>net user /domain

will do that


Jon Finley
Honored Contributor
Solution

Re: domain user group

Ugly.... but works. with a little manipulation, you could make it a comma delimited file for Excel.
-------------------------------

@echo off
net user /domain > domain.txt
for /F "eol=- tokens=1,2,3 delims= " %%i in (domain.txt) do (
net user %%i /domain > user.txt
find "User name" user.txt > myuser.txt
find "*" user.txt >> myuser.txt
for /F "eol=- tokens=1,2,3 delims='*'" %%i in (myuser.txt) do echo %%i, %%j, %%k >> user_groups.txt
net user %%j /domain > user.txt
find "User name" user.txt > myuser.txt
find "*" user.txt >> myuser.txt
for /F "eol=- tokens=1,2,3 delims='*'" %%i in (myuser.txt) do echo %%i, %%j, %%k >> user_groups.txt
net user %%k /domain > user.txt
find "User name" user.txt > myuser.txt
find "*" user.txt >> myuser.txt
for /F "eol=- tokens=1,2,3 delims='*'" %%i in (myuser.txt) do echo %%i, %%j, %%k >> user_groups.txt

)

I'll attach it as a txt file incase this comes out too hacked.

Jon
"Do or do not. There is no try!" - Yoda