By gekko8Created 04 Jun 2013, Modified 26 Oct 2013
My Rating:
Vote
Rating:
Not Rated
Views:4774
Downloads:41

Query User 's AD Groups

Language:  Batch File

Compatibility

Windows XP Yes Windows 2003 Unknown
Windows 2000 Unknown Windows NT Unknown
Vista Unknown Windows 2008 Unknown
Description

This will run a dsquery on the username you enter, display the groups in a text file and delete the text file once completed. The benefit is being able to extract all the groups of the desired user's account under the 'Member Of' tab and copy & paste them into another user. So you can gather the groups from one user and mirror their access to another. #19 from the source URL is the primary command.

Code

Line Numbers: On  Off      Plain Text
@echo off

set /p User=Enter the Username you would like the groups of:

dsquery user -samid %USER% | dsget user -memberof -expand | dsget group -samid > %USER%.txt

%USER%.txt

DEL %USER%.txt

 


Got a useful script? Click here to upload!


 

  Post Comment
Order By:  
User Comments
      
Be the first to post a comment!