Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Import-Module ActiveDirectory -ErrorAction SilentlyContinue
- Do{
- 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!";x=1}
- }While(x=0)
- Do{
- #EVERYTHING AFTER USER IS FOUND
- #GOES HERE
- x=0
- #if you want to go back to start set x to 0 if you want to continue do x=2 and add another do-while loop
- }While(x=1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement