Home
Operating System
Windows
Linux
Tutorial
Windows Server
About
☰
Create user with powershell (windows server)
# Check DNS ROOT and Distinguished Name
Get-AdDomain | Select-Object DNSRoot,DistinguishedName
📋 Copy
Copied!
# List OU Only Distinguished Name
Get-ADOrganizationalUnit -Filter * | Select-object DistinguishedName
📋 Copy
Copied!
# Create New User
New-ADUser ` -Name "Sopuol Seng" ` -GivenName "Sopuol" ` -Surname "Seng" ` -SamAccountName "sopuol" ` -UserPrincipalName "sopuol@server.kh" ` -Path "OU=Team,DC=server,DC=kh" ` -AccountPassword (ConvertTo-SecureString "1" -AsPlainText -Force) ` -Enabled $true ` -PasswordNeverExpires $true
✏️ Edit
📋 Copy
Copied!
# View the User
Get-ADUser -Filter * | Select Name,SamAccountName,DistinguishedName,UserPrincipalName
✏️ Edit
📋 Copy
Copied!
# Remove the User
Remove-ADUser -Identity 'CN=Sopuol Seng,OU=Team,DC=server,DC=kh'
✏️ Edit
📋 Copy
Copied!
# Move the User
Move-ADObject ` -Identity "CN=Sopuol Seng,OU=Team,DC=server,DC=kh" ` -TargetPath "DC=server,DC=kh"
✏️ Edit
📋 Copy
Copied!
Labels
all
(20 )
autocad
(3 )
css
(2 )
linux
(4 )
op_system
(16 )
website
(4 )
windows
(18 )
windowsServer
(15 )