Active Directory Multiple User Create Script

ADDS Related Scripts
User avatar
hamid
Site Admin
Posts: 15
Joined: Mon Jun 17, 2019 2:19 pm
Contact:

Active Directory Multiple User Create Script

Postby hamid Tue Jun 18, 2019 1:17 pm

Hello Club!

PowerShell comes into play again! Here is a simple PowerShell Script which helps you to create multiple user account at the same time.

$Name = Read-Host "Enter Name"
$LastName = Read-Host "Enter Last Name"
$UserName = Read-Host "Enter Username"
$UPN
$Password = Read-Host -AsSecureString "Enter Password"
New-ADUser -name $Name -GivenName $Name -Surname $LastName -SamAccountName Mail$UserName -AccountPassword $Password -UserPrincipalName $UserName@vargonentech.com -Path "OU=vargonentech.com,DC=vargonentech,DC=com" -Enabled $true
New-ADUser -name $Name -GivenName $Name -Surname $LastName -SamAccountName $UserName -AccountPassword $Password -UserPrincipalName $UserName@vargonentech.local -Path "OU=vargonentech.local,DC=vargonentech,DC=com" -Enabled $true
Import-Module 'C:\Program Files\Microsoft\Exchange Server\V15\bin\RemoteExchange.ps1'; Connect-ExchangeServer -auto -ClientApplication:ManagementShell
Enable-mailbox -Identity $UserName@vargonentech.com


Enjoy! :geek:
Microsoft MVP: Cloud and Datacenter Management
Info@hamidsadeghpour.net

Return to “Active Directory”

Who is online

Users browsing this forum: No registered users and 1 guest