Import-Module ActiveDirectory

$username = Read-Host "Enter the username"
$password = Read-Host "Enter the password" -AsSecureString
$firstname = Read-Host "Enter the first name"
$lastname = Read-Host "Enter the last name"
$groupname = Read-Host "Enter the group name"

New-ADUser -Name "$firstname $lastname" -SamAccountName $username -UserPrincipalName "$" -GivenName $firstname -Surname $lastname -Enabled $true -AccountPassword $password -ChangePasswordAtLogon $true
Add-ADGroupMember -Identity $groupname -Members $username
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter