New-ADOrganizationalUnit -Name Nantes -Path "dc=ecole,dc=com"
New-ADOrganizationalUnit -Name ordinateurs -Path "ou=nantes,dc=ecole,dc=com"
New-ADOrganizationalUnit -Name utilisateurs -Path "ou=nantes,dc=ecole,dc=com"

$mdp = (read-host -AsSecureString)

New-ADUser `
-Name "Ahmed Sadki" `
-GivenName Ahmed `
-Surname Sadki `
-DisplayName "ahmed sadki" `
-SamAccountName ahmed `
-UserPrincipalName a.sadki@ecole.com `
-Department Informatique `
-Path "ou=utilisateurs,ou=nantes,dc=ecole,dc=com" `
-Enabled $true `
-ChangePasswordAtLogon $true `
-AccountPassword $mdp `
-City Paris 


New-ADGroup `
-Name TECHS `
-path "ou=utilisateurs,ou=nantes,dc=ecole,dc=com" `
-GroupScope Global `
-GroupCategory Security `
-DisplayName Techs

Add-ADGroupMember `
-Identity Techs -Members a.sadki

$comptes = Get-ADUser -filter * `
-SearchBase "ou=utilisateurs,ou=nantes,dc=ecole,dc=com"
Add-ADGroupMember `
-Identity Techs -Members $comptes


