diff --git a/AD/CreateN1-N2Users/Create-ADtechs.ps1 b/AD/CreateN1-N2Users/Create-ADtechs.ps1 index 7e14fca..6b7d58a 100644 --- a/AD/CreateN1-N2Users/Create-ADtechs.ps1 +++ b/AD/CreateN1-N2Users/Create-ADtechs.ps1 @@ -15,6 +15,9 @@ switch ($modExiste) { Default {Import-Module ActiveDirectory;Import-Module PSWriteColor} } +#On crée le CSV pour y stocker les ID +$pcName = (Get-ComputerInfo).CSName +Set-Content "C:\techLogins-$pcName.csv" -Value "Username,Password" ########### Fonctions ########### function GenPass { #Genere un mdp aléatoire selon les parametres indiqués @@ -83,6 +86,9 @@ ForEach($user in $userList){ "Tech-N3"{$Groups = @($grpDomainAdm)} Default {} } + + $newCsvLine = @([PSCustomObject]@{Username = $user; Password = $userPass} + $newCsvLine | Export-CSV "C:\techLogins-$pcName.csv" -Append -NoTypeInformation -Encoding UTF8 ForEach ($Group in $Groups) {