Ad script
This commit is contained in:
14
AD.ps1
Normal file
14
AD.ps1
Normal file
@@ -0,0 +1,14 @@
|
||||
function Get-RandomPassword {
|
||||
Add-Type -AssemblyName System.Web
|
||||
return ([System.Web.Security.Membership]::GeneratePassword(18, 6))
|
||||
}
|
||||
|
||||
# OU Creation
|
||||
New-ADOrganizationalUnit -Name "COMPTABLE" -Path "DC=chromatic,DC=moe" -ProtectedFromAccidentalDeletion $true
|
||||
New-ADOrganizationalUnit -Name "STAGIAIRE" -Path "DC=chromatic,DC=moe" -ProtectedFromAccidentalDeletion $true
|
||||
New-ADOrganizationalUnit -Name "ADMINISTRATION" -Path "DC=chromatic,DC=moe" -ProtectedFromAccidentalDeletion $true
|
||||
New-ADOrganizationalUnit -Name "CHAUFFEUR" -Path "DC=chromatic,DC=moe" -ProtectedFromAccidentalDeletion $true
|
||||
|
||||
# User Creation
|
||||
$password = Get-RandomPassword
|
||||
New-ADUser -Name "Emerald" -Description "Administrateur reseau" -Path "OU=ADMINISTRATION,DC=chromatic,DC=moe" -AccountPassword $(ConvertTo-SecureString $password -AsPlainText -Force) -ChangePasswordAtLogon $true -PasswordNeverExpires $false -Enabled $true
|
||||
Reference in New Issue
Block a user