Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function FielAutoMenu()
- {
- do
- {
- Write-Host "
- #----------------------------------------------------------#
- # Fiel Auto #
- # #
- # 1. Oprettelse af ny ad bruger #
- # #
- # 0. Slut #
- # #
- #----------------------------------------------------------#
- "
- $hovedmenu = read-host "Indtast valgmulighed 1 til ingenting xD"
- switch ($hovedmenu)
- {
- 1 {NewAD}
- 0 { }
- default
- {
- Write-Host -ForegroundColor red "Forkert valgmulighed"
- sleep 2
- }
- }
- } until ($hovedmenu -eq 0)
- }
- Function NewAD()
- {
- $Domain = "@emil.local"
- $Username = Read-Host "Brugernavn.........."
- $FullName = Read-Host "Fulde navn.........."
- $Password = Read-Host "Password............" | ConvertTo-SecureString -AsPlainText -force
- $Desc = Read-Host "Beskrivelse........."
- $Valg = Read-Host "OU - Salg,Test,Fun.."
- New-ADUser -Name $FullName -UserPrincipalName ($Username + $Domain) -AccountPassword $Password -Description $Desc -Path "OU=$valg" -PassThru | Enable-ADAccount
- }
- FielAutoMenu
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement