Get information about users in AD-group

The below batch-code (.bat) will ask you for an AD-group. It will then run the command net group for the entered AD-group. Paste the result to a temporary text file and open that text file in Notepad for you to view and search through.

@echo off
set /p gname="Enter groupname: "

net group /domain %gname% > C:\temp\groupoutput.txt
notepad C:\temp\groupoutput.txt

Get information about users AD-groups

The below batch-code (.bat) will ask you for an AD-user name. It will then run the command net user for the entered user. Paste the result to a temporary text file and open that text file in Notepad for you to view and search through.

NB! It is also possible to use the command gpresult, if the command net user doesn’t work for you.

@echo off
set /p uname="Enter username: "

net user /domain %uname% > C:\temp\useroutput.txt
REM gpresult /user %uname% /R > C:\temp\useroutput.txt
notepad C:\temp\useroutput.txt