Bulk add user accounts from a file to security group using batch

14 בינואר 2007

If you have a file containing the names of users (sAMAccountName) and you want to add all of them to a specific group in AD, here is a batch script that might make your life easier:   :: GrpFromFile.CMD - Guy Teverovsky - January 2007:: :: Add users from a file to specific group@echo offsetlocal ENABLEDELAYEDEXPANSIONsetlocal ENABLEEXTENSIONSif "%1"=="" goto :SYNTAXif "%1"=="/?" goto :SYNTAXecho/:: Define initial environmentset groupname=%1set filename=%2set scriptname=GrpFromFile:: Determine if supplied arguments were sufficientif "%groupname%"=="" (  echo/  echo ERROR - Insufficient arguments  goto :SYNTAX)if "%filename%"=="" (  echo/  echo ERROR - Insufficient arguments  goto :SYNTAX)if not exist "%filename%" (  echo/  echo ERROR - File not found  goto :SYNTAX):: Locate critical...
4 תגובות