One of the most fundamental and often repeated task by an administrator is to create, copy or remove an Active directory user. Thanks to the New-ADUser cmdlet, it is extremely simple. Below are the PowerShell scripts to create, copy and remove an Active Directory user.
This command creates a new user under the name “John Doe”, with other attributes like surname, SamAccountName, UserPrincipalName and AccountPassword. The user is enabled and stationed under the OU – “Employees” in the domain -- “abc.com”
This command retrieves the user account "jdoe" to get its attributes and creates a new user account named "Jane Doe" with the same. The only exception here are the name and SAM account name, which are set to "Jane Doe" and "jdoe2", respectively. The new user account is placed in the OU – "Employees".
The third command removes the user account "jdoe" with confirmation set to false, meaning there won’t be any prompt before deleting.
These steps are easier when only a handful of accounts are to be handled. But when there are a large amount of users involved in the process, there are certain ways to get that done easily.
To perform bulk operations associated with the above activities these steps will help achieve them easily.