Advertisement
Guest User

Untitled

a guest
Feb 20th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. function FielAutoMenu()
  2. {
  3.  
  4. do
  5. {
  6. Write-Host "
  7. #----------------------------------------------------------#
  8. # Fiel Auto #
  9. # #
  10. # 1. Oprettelse af ny ad bruger #
  11. # #
  12. # 0. Slut #
  13. # #
  14. #----------------------------------------------------------#
  15. "
  16.  
  17.  
  18. $hovedmenu = read-host "Indtast valgmulighed 1 til ingenting xD"
  19.  
  20. switch ($hovedmenu)
  21. {
  22. 1 {NewAD}
  23. 0 { }
  24. default
  25. {
  26. Write-Host -ForegroundColor red "Forkert valgmulighed"
  27. sleep 2
  28. }
  29. }
  30. } until ($hovedmenu -eq 0)
  31. }
  32.  
  33. Function NewAD()
  34.  
  35. {
  36. $Domain = "@emil.local"
  37.  
  38. $Username = Read-Host "Brugernavn.........."
  39. $FullName = Read-Host "Fulde navn.........."
  40. $Password = Read-Host "Password............" | ConvertTo-SecureString -AsPlainText -force
  41. $Desc = Read-Host "Beskrivelse........."
  42. $Valg = Read-Host "OU - Salg,Test,Fun.."
  43.  
  44.  
  45. New-ADUser -Name $FullName -UserPrincipalName ($Username + $Domain) -AccountPassword $Password -Description $Desc -Path "OU=$valg" -PassThru | Enable-ADAccount
  46.  
  47. }
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54. FielAutoMenu
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement