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 "$username@domain.com" -GivenName $firstname -Surname $lastname -Enabled $true -AccountPassword $password -ChangePasswordAtLogon $true Add-ADGroupMember -Identity $groupname -Members $username