Home
Operating System
Windows
Linux
Tutorial
Windows Server
About
☰
Create group with powershell (windows server)
# List OU Only Distinguished Name
Get-ADOrganizationalUnit -Filter * | Select-object DistinguishedName
📋 Copy
Copied!
# Create New Group
New-ADGroup ` -Name "GroupName" ` -SamAccountName "GroupName" ` -GroupCategory Security ` -GroupScope Global ` -Path "OU=team,DC=server,DC=kh"
✏️ Edit
📋 Copy
Copied!
-GroupScope Global or Universal
## View the Group
Get-ADGroup -Filter * | Select Name,DistinguishedName
✏️ Edit
📋 Copy
Copied!
## Remove the Group
Remove-ADGroup -Identity 'CN=GroupName,OU=Team,DC=server,DC=kh'
✏️ Edit
📋 Copy
Copied!
## Move the Group
Move-ADObject ` -Identity "CN=GroupName,OU=Team,DC=server,DC=kh" ` -TargetPath "DC=server,DC=kh"
✏️ Edit
📋 Copy
Copied!
# Add Users to the Group
Add-ADGroupMember -Identity "GroupName" -Members "sopuol"
✏️ Edit
📋 Copy
Copied!
## View GroupMember
Get-ADGroupMember -Identity "GroupName"
✏️ Edit
📋 Copy
Copied!
Labels
all
(31 )
autocad
(3 )
css
(2 )
linux
(5 )
op_system
(18 )
website
(4 )
windows
(14 )
windowsServer
(27 )