If you want to Create an Active Directory group with PowerShell there are a few things you need to be aware of:

First of all there is no direct way to create new objects in Active Directory. You always need to bind to the Domain or an Organizational Unit and call the Create method.


However the group is not yet complete:

Group name (pre-Windows 2000)

So we need to set the sAMAccountName property:

however this will fail with the error message:

This happens because we first need to call CommitChanges() before setting additional properties:

Last step is to change the group type, which can be done using the groupType property:

And all the pieces together: