Advertisement
Guest User

Untitled

a guest
Feb 10th, 2016
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1.  
  2. Import-Module ActiveDirectory -ErrorAction SilentlyContinue
  3. Do{
  4. Write-Host "********************************************************************"
  5. Write-Host "** New User Creation Script **"
  6. Write-Host "********************************************************************"
  7.  
  8. #----------------------------------------------------------
  9. #
  10. #Ask for the information required for the new UserAccount
  11. #----------------------------------------------------------
  12.  
  13. $FirstName = Read-Host "Enter users's First Name"
  14. $LastName = Read-Host "Enter user's Last Name"
  15. $UserName = Read-Host "Enter user ID (ie - arasool)"
  16. $Password = Read-Host "Enter user's Password - Symbols are allowed"
  17. Write-Host "Checking if user already exists - Please give this time."
  18.  
  19. Start-Sleep -s 5
  20. #----------------------------------------------------------
  21. #
  22. #Check - Does this user already exist?
  23. #----------------------------------------------------------
  24. $Name = $UserName
  25. $User = Get-ADUser -Filter {sAMAccountName -eq $UserName}
  26. If ($User -eq $Null) {"User does not exist"} -ForegroundColor RED
  27. Else {$Answer -eq "User exists!";x=1}
  28. }While(x=0)
  29. Do{
  30. #EVERYTHING AFTER USER IS FOUND
  31. #GOES HERE
  32. x=0
  33. #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
  34. }While(x=1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement