# show current group list
PS C:\Users\Administrator> Get-ADGroup -Filter * | Format-Table DistinguishedName
DistinguishedName
-----------------
CN=Administrators,CN=Builtin,DC=srv,DC=world
CN=Users,CN=Builtin,DC=srv,DC=world
CN=Guests,CN=Builtin,DC=srv,DC=world
CN=Print Operators,CN=Builtin,DC=srv,DC=world
CN=Backup Operators,CN=Builtin,DC=srv,DC=world
.....
.....
# for example, add [Development01] group
PS C:\Users\Administrator> New-ADGroup Development01 `
-GroupScope Global `
-GroupCategory Security `
-Description "Database Admin Group"
# verify
PS C:\Users\Administrator> Get-ADGroup -Identity Development01
DistinguishedName : CN=Development01,CN=Users,DC=srv,DC=world
GroupCategory : Security
GroupScope : Global
Name : Development01
ObjectClass : group
ObjectGUID : 0c353afe-37d9-49ba-ac4f-ba1295a78e8e
SamAccountName : Development01
SID : S-1-5-21-220755274-1434786659-4133053638-1108
# to add a member to a group, run like follows
PS C:\Users\Administrator> Add-ADGroupMember -Identity Development01 -Members Serverworld
# verify
PS C:\Users\Administrator> Get-ADGroupMember -Identity Development01
distinguishedName : CN=Server World,CN=Users,DC=srv,DC=world
name : Server World
objectClass : user
objectGUID : 5224b6a8-c9e7-4561-aabd-285c376a1012
SamAccountName : Serverworld
SID : S-1-5-21-220755274-1434786659-4133053638-1103
# to delete a member from a group, run like follows
PS C:\Users\Administrator> Remove-ADGroupMember -Identity Development01 -Members Serverworld
Confirm
Are you sure you want to perform this action?
Performing the operation "Set" on target "CN=Development01,CN=Users,DC=srv,DC=world".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): Y
# to delete a group, run like follows
PS C:\Users\Administrator> Remove-ADGroup -Identity Development01
Confirm
Are you sure you want to perform this action?
Performing the operation "Remove" on target "CN=Development01,CN=Users,DC=srv,DC=world".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): Y
|