Active Directory – Create new User and set Password
$newPassword = ConvertTo-SecureString -String “Passw789!” -AsPlainText -Force
New-ADUser -name Joern -Department IT -Title Chef -City Essen -AccountPassword $newPassword -Enabled $True
oder
Import-Module ActiveDirectory
New-ADUser `
-Name “JoernWalter” `
-Path “OU=TestOU,DC=ndsedv,DC=de” `
-SamAccountName “JoernWalter” `
-DisplayName “Joern Walter” `
-AccountPassword (ConvertTo-SecureString “P@sswo12.” -AsPlainText -Force) `
-ChangePasswordAtLogon $true `
-Enabled $true
Add-ADGroupMember “Domain Admins” “JoernWalter”