Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $Start
- Import-Module ActiveDirectory -ErrorAction SilentlyContinue
- Write-Host "********************************************************************"
- Write-Host "** New User Creation Script **"
- Write-Host "********************************************************************"
- #----------------------------------------------------------
- #
- #Ask for the information required for the new UserAccount
- #----------------------------------------------------------
- $FirstName = Read-Host "Enter users's First Name"
- $LastName = Read-Host "Enter user's Last Name"
- $UserName = Read-Host "Enter user ID (ie - arasool)"
- $Password = Read-Host "Enter user's Password - Symbols are allowed"
- Write-Host "Checking if user already exists - Please give this time."
- Start-Sleep -s 5
- #----------------------------------------------------------
- #
- #Check - Does this user already exist?
- #----------------------------------------------------------
- $Name = $UserName
- $User = Get-ADUser -Filter {sAMAccountName -eq $UserName}
- If ($User -eq $Null) {"User does not exist"} -ForegroundColor RED
- Else {$Answer -eq "User exists!"}
- If ($Answer = "User exists!") {Do $Start}
- Else {break}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement