Related to creating objects in AD, learn how to create and manage Group Accounts in Active Directory within Windows Servers. You can perform the tasks on all Windows Servers from 2008 to 2012 R2. Using PowerShell to manage Active Directory is not hard, if you try to understand the PowerShell CmdLets structures.
Manage Group Accounts in Active Directory Using PowerShell
The easy way to learn PowerShell is to perform some simple network management tasks with PowerShell. Specially when you are working with Active directory, Exchange Server, and other Microsoft products.
Create and Mange Group Accounts in Active Directory
In Windows Server run PowerShell and load active directory module. Type ‘Import-Module activedirectory’ and press enter.
To see the result, type ‘Get-Module’ and press enter.
Find the related PowerShell CmdLets for group account, type ‘Get-Command *ADGroup*’ and press enter.
Create a group with ‘New-ADGroup’
PS C:\> New-ADGroup -Name “Sales Team” -DisplayName “Sales Members” -SamAccountName SalesTeam -GroupScope global -GroupCategory Security -Description “Technig Products Sales Team”
To see the group account attributes or Properties type ‘Get-ADGroup -Identity salesteam -Properties *’ and press enter.
You can add users to a Group with ‘Add-ADGroupMember -Identity Salesteam -Members Nigar,Mahdi’ command.
Now I have added users Nigar and Mahdi to SalesTeam group.
The ‘Get-ADGroupMember salesteam’ will show you all members of SalesTeam group.
Remove a user from group, type ‘Remove-ADGroupMember -Identity SalesTeam -Members Mahdi’ and press enter. When ask you Are you sure you want to perform this action? Just type Y then press enter to accept it.
Do the same to remove a group with Remove-ADGroup command. If you want to modify a group attributes, do it with Set-ADGroup command.
OK friends that’s all about How to Create and Manage group accounts in active directory. You may need to read How to create User Account with PowerShell in Active Directory or you have any question? just ask trough comment.