top of page

PowerShell New-ADGroup

So let’s say you want to create a new unique group for each of your servers to add each one to all the local admin groups on your servers so you can simple add a user account to a group and then they have admin rights on that specific machine.  I would want a simple fast way to create a list of groups in AD from a csv file. That is what is being done below with attached sample file to allow following the correct header format.

#------Import CSV With Group Info-------
$MyGroups = Import-csv C:\temp\Book1.csv
 

#----------Da Loop----------
foreach ($Group in $MyGroups){
New-ADGroup -Path $Group.Path -Name $Group.Name -GroupScope Global -GroupCategory Security -Description $Group.Description -OtherAttributes @{info=($Group.Info)}
}

​

Sample File CSV

ADGroups.PNG
bottom of page