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