October 30th, 2013

PowerTip: Create an Active Directory Group with PowerShell

Doctor Scripto
Scripter

Summary: Use Windows PowerShell to create a security group in Active Directory.

Hey, Scripting Guy! Question How can I use Windows PowerShell to create a security group in Active Directory?

Hey, Scripting Guy! Answer In Windows Server 2012 R2 or Windows Server 2008 R2, use the New-ADGroup cmdlet.

To create a new global group in the default Users folder of Active Directory called “Finance”:

NEW-ADGroup –name “Finance” –groupscope Global

If it needs to exist in different path in Active Directory, specify the path by its distinguished name:

NEW-ADGroup –name “Finance” –groupscope Global –path “OU=Offices,DC=Contoso,DC=local”

Author

The "Scripting Guys" is a historical title passed from scripter to scripter. The current revision has morphed into our good friend Doctor Scripto who has been with us since the very beginning.

1 comment

Discussion is closed. Login to edit/delete existing comments.

  • Pablo Villaronga

    Hi Dr, apologies if this is not the correct topic for this , how can I to create and invoke a a File “Mygroups.csv” with all info from 
    –name “xxx”
    -SamAccountName “sameasname”
    -GroupCategory Security
    -GroupScope Global
    -DisplayName “Sameasname Administrators”
    -Path “CN=Users,DC=contoso,DC=local”
    -Description “Members of this group are %name%  Administrators”

    Thanks ! 

    Like 
    “New-ADGroup ./mygroups.csv”