1 2 3 4 5 6 7 8 9 10 11 12
| Import-Module ActiveDirectory
$upnsuffix = "@demo1.local"
Import-Csv "c:\chemin\adusers.csv" -Delimiter ";" | Select-Object *,
@{Name="Name"; Expression={$_.Prenom+" "+$_.Nom}},
@{Name="GivenName"; Expression={$_.Prenom}},
@{Name="Surname"; Expression={$_.Nom}},
@{Name="Path"; Expression={$_.Affection}},
@{Name="DisplayName"; Expression={$_.Prenom+" "+$_.Nom}},
@{Name="UserPrincipalName"; Expression={$_.Identifiant+$upnsuffix}},
@{Name="SamAccountName"; Expression={$_.Identifiant}},
@{Name="AccountPassword"; Expression={ConvertTo-SecureString $_."mot de passe" -AsPlainText -Force}},
@{Name="Enabled"; Expression={$true}} | New-ADUser |
Partager