It is easy to learn PowerShell commands for Active Directory(AD) user creation , deletion and modification. If we know the Active Directory attributes then its easy to do lot of operations using PowerShell commands. It will help us to create PowerShell scripts Automation.
Please follow the below steps to create and Disable AD users using PowerShell script.
Open the PowerShell with admin right as below,
Run the below commands to create New AD user.
New-ADUser -Name "John Smith" -GivenName "John" -Surname "Smith" -DisplayName " John Smith" -EmailAddress "This email address is being protected from spambots. You need JavaScript enabled to view it." -Company "Domain.COM" -Title "Senior Software Engineering" -Department "BU4 (SYSTEM TEAM)" -EmployeeID "45"-Manager "CN=RANGANATHAN S,OU=Developers,OU=cicrs,DC=Domain,DC=COM" -SamAccountName "Jsmith" -UserPrincipalName "This email address is being protected from spambots. You need JavaScript enabled to view it." -Path "OU=Testers, OU=cic,DC=domain,DC=com" -AccountPassword(Read-Host -AsSecureString "Input Password") -Enabled $true
Refer the below image
To disable an AD user please refer the below command
Disable-ADAccount -Identity Jsmith
Jsmith should be match with SAMAccountName of the AD user.
CHG IT Consultancy Pvt. Ltd. is a subsidiary of CIC Holdings Co. Ltd. Japan. Our company is focused on IT related solutions to reap the benefits of global popularity of Software Industry.
Registered Office
CHG IT CONSULTANCY PVT LTD
STPI Technology Incubation Centre, 2nd Floor, No.5, Rajiv Gandhi Salai, Taramani, Chennai – 600113, Tamil Nadu, INDIA