commit 65b7d5461b1dda256ae7e13b54684361ee4e4404 Author: 7ka1 <7ka1@noreply.localhost> Date: Tue Jan 27 09:27:44 2026 +0000 Téléverser les fichiers vers "/" diff --git a/backup_users.ps1 b/backup_users.ps1 new file mode 100644 index 0000000..a055f41 --- /dev/null +++ b/backup_users.ps1 @@ -0,0 +1,37 @@ +# Nom du script : backup_users.ps1 +Import-Module ActiveDirectory + +$dateStr = Get-Date -Format "yyyy-MM-dd" +# 1. Correction : Il faut des guillemets autour du chemin +$backupDir = "C:\backups\" +$csvFile = "${backupDir}${dateStr}_users.csv" +$zipFile = "${backupDir}${dateStr}_users.zip" + +# Création du dossier si nécessaire +if (-not (Test-Path $backupDir)) { + New-Item -Path $backupDir -ItemType Directory | Out-Null +} + +Write-Host "--- Sauvegarde AD ---" -ForegroundColor Cyan + +# 2. Correction : Ajout de l'étoile '*' pour le filtre et le pipe '|' pour le Where-Object +# Le filtre '*' signifie "tout le monde". +$users = Get-ADUser -Filter * -Properties Department, Title | Where-Object { $_.DistinguishedName -like "*OU=*" } + +if ($users) { + # 3. Correction : Ajout des pipes '|' pour enchaîner les commandes + $users | Select-Object Name, SamAccountName, Department, Title | Export-Csv -Path $csvFile -NoTypeInformation -Encoding UTF8 -Delimiter ";" + + # Compression (Ecrase si existe déjà) + if (Test-Path $zipFile) { Remove-Item $zipFile } + + # Note : Compress-Archive est natif sur Windows 10/Server 2016+ + Compress-Archive -Path $csvFile -DestinationPath $zipFile + + # Nettoyage du CSV temporaire + Remove-Item $csvFile + + Write-Host "[OK] Sauvegarde terminée : $zipFile" -ForegroundColor Green +} else { + Write-Host "Rien à sauvegarder." -ForegroundColor Yellow +} \ No newline at end of file diff --git a/generate_passwords.ps1 b/generate_passwords.ps1 new file mode 100644 index 0000000..568bd3f --- /dev/null +++ b/generate_passwords.ps1 @@ -0,0 +1,28 @@ +function Generate-RandomPassword { + param([int]$Length = 12) + $chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!$#%&" + $password = "" + for ($i = 0; $i -lt $Length; $i++) { + $password += $chars.ToCharArray() | Get-Random + } + return $password +} + +# 1. Définir le chemin du fichier +$path = "C:\Users\vboxuser\Desktop\Scripts\happy_koalas_employees.csv" + +# 2. Charger les données en mémoire +# On utilise une variable ($data) pour libérer le fichier après la lecture +$data = Import-Csv -Path $path -Delimiter ";" + +# 3. Remplir la colonne Password si elle est vide +foreach ($row in $data) { + if ([string]::IsNullOrWhiteSpace($row.Password)) { + $row.Password = Generate-RandomPassword -Length 10 + } +} + +# 4. Réécrire par-dessus le fichier original +$data | Export-Csv -Path $path -NoTypeInformation -Delimiter ";" -Encoding utf8 + +Write-Host "Le fichier original a été mis à jour avec succès !" -ForegroundColor Cyan \ No newline at end of file diff --git a/happy_koalas_employees.csv b/happy_koalas_employees.csv new file mode 100644 index 0000000..1aa0dde --- /dev/null +++ b/happy_koalas_employees.csv @@ -0,0 +1,215 @@ +"FirstName";"LastName";"UserName";"Password";"Email";"Department";"JobTitle" +"Wendy";"Thompson";"wthompson";"etPFmA3D0E";"wthompson@happykoalas.com";"IT";"Developer" +"Laura";"Clark";"lclark";"%gSrA2l4Uu";"lclark@happykoalas.com";"Production";"Assembler" +"Zack";"Lewis";"zlewis";"zzNAgIPMix";"zlewis@happykoalas.com";"Production";"Supervisor" +"Bob";"Walker";"bwalker";"g%MSLxcP7t";"bwalker@happykoalas.com";"Production";"Operator" +"Nina";"Thomas";"nthomas";"t2A7f6HJW$";"nthomas@happykoalas.com";"Production";"Assembler" +"Diana";"Walker";"dwalker";"u$NGL6gVdT";"dwalker@happykoalas.com";"Production";"Supervisor" +"Diana";"White";"dwhite";"FcBCM6yR4k";"dwhite@happykoalas.com";"Production";"Operator" +"Nina";"Jackson";"njackson";"LXM1TYmhqX";"njackson@happykoalas.com";"Production";"Supervisor" +"Rachel";"Harris";"rharris";"R0XO#hYO6m";"rharris@happykoalas.com";"Marketing";"Content Creator" +"Ian";"Clark";"iclark";"5byua038QJ";"iclark@happykoalas.com";"Marketing";"Content Creator" +"Kevin";"Taylor";"ktaylor";"PsD11NM#VX";"ktaylor@happykoalas.com";"Marketing";"SEO Manager" +"Xavier";"Harris";"xharris";"d6!5sG9eqd";"xharris@happykoalas.com";"Marketing";"Marketing Specialist" +"Laura";"Rodriguez";"lrodriguez";"PZ8bQh0qi1";"lrodriguez@happykoalas.com";"Production";"Assembler" +"Alice";"Hall";"ahall";"pN7bcE5FYv";"ahall@happykoalas.com";"Marketing";"Content Creator" +"Fiona";"Martinez";"fmartinez";"t8uXksoTGG";"fmartinez@happykoalas.com";"Finance";"Financial Analyst" +"Oscar";"Lewis";"olewis";"MpQYOx&aBY";"olewis@happykoalas.com";"Production";"Operator" +"Xavier";"Anderson";"xanderson";"qxLPpVfKwA";"xanderson@happykoalas.com";"Production";"Supervisor" +"Rachel";"Thomas";"rthomas";"r5RkxLlMiG";"rthomas@happykoalas.com";"Production";"Supervisor" +"Zack";"Lewis";"zlewis";"YwOaARlW7n";"zlewis@happykoalas.com";"Production";"Operator" +"Ian";"Hall";"ihall";"UiAT4nB6n!";"ihall@happykoalas.com";"Marketing";"Marketing Specialist" +"Steve";"Harris";"sharris";"LU3BPhPIiB";"sharris@happykoalas.com";"Production";"Operator" +"Uma";"Harris";"uharris";"Z0lO$KLz!7";"uharris@happykoalas.com";"Production";"Assembler" +"Diana";"Robinson";"drobinson";"CM$yRMz0Tm";"drobinson@happykoalas.com";"Production";"Assembler" +"Diana";"Walker";"dwalker";"x5eRWc1E3O";"dwalker@happykoalas.com";"Finance";"Financial Analyst" +"George";"Jackson";"gjackson";"ZEtaqmNUpA";"gjackson@happykoalas.com";"Production";"Operator" +"Diana";"Thompson";"dthompson";"ECozZTK54Q";"dthompson@happykoalas.com";"RH";"Recruiter" +"Ian";"Smith";"ismith";"6%5BAxcDZG";"ismith@happykoalas.com";"Production";"Operator" +"Hannah";"Martinez";"hmartinez";"q8laTXQTsD";"hmartinez@happykoalas.com";"Production";"Assembler" +"Oscar";"Smith";"osmith";"xJ2iqZX8AX";"osmith@happykoalas.com";"Marketing";"SEO Manager" +"Alice";"Thompson";"athompson";"xCvBiceaMy";"athompson@happykoalas.com";"Production";"Operator" +"Yara";"Clark";"yclark";"YMpH2KpDjR";"yclark@happykoalas.com";"Production";"Supervisor" +"Julia";"Smith";"jsmith";"hckqXlmKh8";"jsmith@happykoalas.com";"Production";"Assembler" +"Uma";"Thomas";"uthomas";"A%jo0gfzI3";"uthomas@happykoalas.com";"Marketing";"SEO Manager" +"Laura";"Martin";"lmartin";"xucrvBx215";"lmartin@happykoalas.com";"Production";"Operator" +"Tina";"Lee";"tlee";"ZfExfONQsj";"tlee@happykoalas.com";"Production";"Supervisor" +"Ian";"Lee";"ilee";"$CaosZuR3P";"ilee@happykoalas.com";"RH";"HR Specialist" +"Nina";"Lewis";"nlewis";"2BG3PxE5IB";"nlewis@happykoalas.com";"Production";"Operator" +"Victor";"Thomas";"vthomas";"yYwdJCLcpV";"vthomas@happykoalas.com";"Production";"Assembler" +"Steve";"Johnson";"sjohnson";"j5cRRZDp8F";"sjohnson@happykoalas.com";"Production";"Supervisor" +"Fiona";"Anderson";"fanderson";"Mdbt5ugG3z";"fanderson@happykoalas.com";"Production";"Operator" +"Rachel";"Jackson";"rjackson";"%wPJsrG18!";"rjackson@happykoalas.com";"Marketing";"SEO Manager" +"Nina";"Anderson";"nanderson";"Pm1GL#wLsQ";"nanderson@happykoalas.com";"Production";"Operator" +"Rachel";"Walker";"rwalker";"uNfBZ6T&2Q";"rwalker@happykoalas.com";"Production";"Operator" +"Wendy";"Martinez";"wmartinez";"kNlf%3SMr1";"wmartinez@happykoalas.com";"IT";"IT Support" +"Steve";"Thomas";"sthomas";"itJUKNRLY7";"sthomas@happykoalas.com";"IT";"System Administrator" +"Alice";"Walker";"awalker";"06dpx6Lnhr";"awalker@happykoalas.com";"Production";"Assembler" +"Yara";"Harris";"yharris";"6NxdPP5alm";"yharris@happykoalas.com";"RH";"Recruiter" +"Evan";"Smith";"esmith";"CIPRFhQeBQ";"esmith@happykoalas.com";"IT";"IT Support" +"Paula";"Martin";"pmartin";"gigKtGb&Db";"pmartin@happykoalas.com";"Production";"Assembler" +"Alice";"Walker";"awalker";"ETCDuaRjJd";"awalker@happykoalas.com";"Marketing";"SEO Manager" +"Zack";"Jackson";"zjackson";"C#8HbcsZ1n";"zjackson@happykoalas.com";"Marketing";"Marketing Specialist" +"Victor";"Clark";"vclark";"kXzt3OcSMb";"vclark@happykoalas.com";"Production";"Supervisor" +"Alice";"White";"awhite";"Euy%VUwKuN";"awhite@happykoalas.com";"Production";"Supervisor" +"Steve";"White";"swhite";"arCG3qFU8Z";"swhite@happykoalas.com";"Production";"Operator" +"Quentin";"Johnson";"qjohnson";"AtLx$22fIM";"qjohnson@happykoalas.com";"Production";"Operator" +"Tina";"Thomas";"tthomas";"rd8BkJhCwm";"tthomas@happykoalas.com";"Production";"Supervisor" +"Quentin";"Thompson";"qthompson";"M1mFwXJ8%q";"qthompson@happykoalas.com";"IT";"Developer" +"Evan";"Smith";"esmith";"HtPqV9OxQf";"esmith@happykoalas.com";"Finance";"Financial Analyst" +"Quentin";"Lewis";"qlewis";"8swV#4G1S0";"qlewis@happykoalas.com";"Marketing";"Content Creator" +"Charlie";"Clark";"cclark";"PXsxcC$iCG";"cclark@happykoalas.com";"Production";"Operator" +"Fiona";"Thompson";"fthompson";"M!Oul1UDOm";"fthompson@happykoalas.com";"Production";"Operator" +"George";"Lewis";"glewis";"25thL%mblh";"glewis@happykoalas.com";"Marketing";"Content Creator" +"Laura";"Jackson";"ljackson";"WCVF!lcw%h";"ljackson@happykoalas.com";"Production";"Assembler" +"Oscar";"Anderson";"oanderson";"oxNsKZ313y";"oanderson@happykoalas.com";"Production";"Assembler" +"Bob";"Jackson";"bjackson";"NmY5T%Qg%o";"bjackson@happykoalas.com";"Production";"Supervisor" +"Xavier";"Lee";"xlee";"!TOW5RmikJ";"xlee@happykoalas.com";"Marketing";"Marketing Specialist" +"Tina";"Walker";"twalker";"7akv9anH1V";"twalker@happykoalas.com";"IT";"Developer" +"Paula";"White";"pwhite";"cH64rzxMOl";"pwhite@happykoalas.com";"Production";"Assembler" +"Fiona";"Johnson";"fjohnson";"A#S9G#9FDn";"fjohnson@happykoalas.com";"Production";"Operator" +"Xavier";"Brown";"xbrown";"7!sS0PB7OY";"xbrown@happykoalas.com";"Marketing";"Content Creator" +"Paula";"Thompson";"pthompson";"Z$n1d&Em0x";"pthompson@happykoalas.com";"Production";"Supervisor" +"Nina";"Walker";"nwalker";"c$beYwFlZ9";"nwalker@happykoalas.com";"Production";"Operator" +"Victor";"Lee";"vlee";"gQjCylXbEG";"vlee@happykoalas.com";"Production";"Supervisor" +"Steve";"Garcia";"sgarcia";"GG2Fkf$UP0";"sgarcia@happykoalas.com";"Marketing";"Marketing Specialist" +"George";"Thompson";"gthompson";"o5vFSRq23x";"gthompson@happykoalas.com";"Marketing";"Content Creator" +"Julia";"Brown";"jbrown";"u5cFqlOFuz";"jbrown@happykoalas.com";"Production";"Operator" +"Uma";"White";"uwhite";"d&ADVUD53o";"uwhite@happykoalas.com";"Marketing";"Marketing Specialist" +"Zack";"Anderson";"zanderson";"QIK1h6sEWz";"zanderson@happykoalas.com";"Production";"Assembler" +"Fiona";"White";"fwhite";"S7PDDft8vs";"fwhite@happykoalas.com";"IT";"System Administrator" +"Fiona";"Clark";"fclark";"qXn076tqFt";"fclark@happykoalas.com";"Production";"Operator" +"Alice";"Anderson";"aanderson";"w%CyJK7nGT";"aanderson@happykoalas.com";"Production";"Operator" +"Paula";"Robinson";"probinson";"HU9dcHqilt";"probinson@happykoalas.com";"Marketing";"SEO Manager" +"Laura";"Rodriguez";"lrodriguez";"AAy!KO3npZ";"lrodriguez@happykoalas.com";"IT";"IT Support" +"Ian";"Martinez";"imartinez";"kVAzayMtXV";"imartinez@happykoalas.com";"IT";"System Administrator" +"Steve";"Jackson";"sjackson";"jiP4eawpyr";"sjackson@happykoalas.com";"Marketing";"Content Creator" +"Kevin";"Thompson";"kthompson";"pzi5A97Q#5";"kthompson@happykoalas.com";"Production";"Supervisor" +"Uma";"Martinez";"umartinez";"WpOOFDq&F0";"umartinez@happykoalas.com";"Production";"Supervisor" +"Victor";"Hall";"vhall";"WX%ev7r3BY";"vhall@happykoalas.com";"Marketing";"Content Creator" +"Hannah";"Brown";"hbrown";"3Q#YcVTVv5";"hbrown@happykoalas.com";"Production";"Supervisor" +"George";"Hall";"ghall";"prJmUAS&t3";"ghall@happykoalas.com";"RH";"Recruiter" +"Julia";"Walker";"jwalker";"iuiE!KGzdU";"jwalker@happykoalas.com";"RH";"HR Specialist" +"Hannah";"Lee";"hlee";"8OwVh!n2y&";"hlee@happykoalas.com";"RH";"Recruiter" +"Tina";"White";"twhite";"Y1XX#YCGP2";"twhite@happykoalas.com";"Production";"Operator" +"Diana";"Harris";"dharris";"F2TGJiNPVS";"dharris@happykoalas.com";"Production";"Operator" +"Kevin";"Clark";"kclark";"wm2y3zQNSn";"kclark@happykoalas.com";"Production";"Operator" +"Uma";"Jackson";"ujackson";"AOaXBCNLro";"ujackson@happykoalas.com";"Production";"Operator" +"Uma";"Harris";"uharris";"RIQqAoX!vu";"uharris@happykoalas.com";"Production";"Operator" +"Alice";"Martinez";"amartinez";"xVu8GXFMC6";"amartinez@happykoalas.com";"IT";"Developer" +"Steve";"Thompson";"sthompson";"XmNRmfpe6A";"sthompson@happykoalas.com";"Production";"Assembler" +"Ian";"Harris";"iharris";"Sxt&87%X!9";"iharris@happykoalas.com";"Marketing";"Marketing Specialist" +"Steve";"Walker";"swalker";"pMetVXxrfU";"swalker@happykoalas.com";"Production";"Supervisor" +"Zack";"Clark";"zclark";"EY1V5UBDj5";"zclark@happykoalas.com";"Production";"Supervisor" +"Bob";"Thompson";"bthompson";"dHTYO71PF!";"bthompson@happykoalas.com";"Marketing";"Content Creator" +"Alice";"Jackson";"ajackson";"K5msnTwEYF";"ajackson@happykoalas.com";"Production";"Operator" +"Hannah";"Thomas";"hthomas";"!Exd5v57bJ";"hthomas@happykoalas.com";"Finance";"Financial Analyst" +"Zack";"Brown";"zbrown";"i8XgibBXTG";"zbrown@happykoalas.com";"IT";"IT Support" +"Charlie";"White";"cwhite";"Hgj2ZiAvIC";"cwhite@happykoalas.com";"Production";"Assembler" +"Diana";"Lee";"dlee";"mAz&TIWMya";"dlee@happykoalas.com";"RH";"HR Specialist" +"Quentin";"Hall";"qhall";"LIhOXC8Nds";"qhall@happykoalas.com";"Production";"Supervisor" +"Hannah";"Rodriguez";"hrodriguez";"zYR5r6&9!E";"hrodriguez@happykoalas.com";"Production";"Supervisor" +"Bob";"Smith";"bsmith";"rkd&QHMHGl";"bsmith@happykoalas.com";"Production";"Assembler" +"Evan";"Smith";"esmith";"vo8KV%euSH";"esmith@happykoalas.com";"Marketing";"Content Creator" +"Julia";"Lewis";"jlewis";"9AScko4bPQ";"jlewis@happykoalas.com";"Production";"Supervisor" +"Victor";"Lee";"vlee";"CwZXv0ILUZ";"vlee@happykoalas.com";"Production";"Assembler" +"Fiona";"Lee";"flee";"MJ3&Wnhy0F";"flee@happykoalas.com";"Production";"Operator" +"Steve";"White";"swhite";"bZ1Rv98qN7";"swhite@happykoalas.com";"Marketing";"SEO Manager" +"Alice";"Dale";"adale";"OXU%8!#MI6";"adale@happykoalas.com";"IT";"IT Support" +"Rafael";"Ferreira Da Costa";"rferreira";"Uh0MLzA1#b";"rferreira@happykoalas.com";"IT";"IT Support" +"David";"Gillard";"dgillard";"McuNBSgLUg";"dgillard@happykoalas.com";"IT";"IT Support" +"Dana Maria";"Jaquenod";"djaquenod";"tiTF%%j9tu";"djaquenod@happykoalas.com";"IT";"IT Support" +"Mohamad";"Jasser";"mjasser";"qm!KplQFM$";"mjasser@happykoalas.com";"IT";"IT Support" +"Abukar";"Mohamed Ali";"amohamed";"Cwh%hiSIRo";"amohamed@happykoalas.com";"IT";"IT Support" +"Steven";"Pillonel";"spillonel";"p5ehqeEnJI";"spillonel@happykoalas.com";"IT";"IT Support" +"Jorge";"Pinho Dias";"jpinho";"1CrtNR0D#f";"jpinho@happykoalas.com";"IT";"IT Support" +"Jasantha";"Ramajeyam";"jramajeyam";"$znvQ#gsKp";"jramajeyam@happykoalas.com";"IT";"IT Support" +"Stanislas";"Rohrbach";"srohrbach";"1dr&t8CnX8";"srohrbach@happykoalas.com";"IT";"IT Support" +"Shania";"Sangiorgio";"ssangiorgio";"cLUX!%izFT";"ssangiorgio@happykoalas.com";"IT";"IT Support" +"Noah-Lisandru";"Schmidt";"nschmidt";"r1Ss#KHQHs";"nschmidt@happykoalas.com";"IT";"IT Support" +"Chris";"Simao dos Santos";"csimao";"FwE1i%Auw7";"csimao@happykoalas.com";"IT";"IT Support" +"Dijon";"Sims";"dsims";"s5hskmTdup";"dsims@happykoalas.com";"IT";"IT Support" +"Leo";"Toffel";"ltoffel";"cvVd9VDMvl";"ltoffel@happykoalas.com";"IT";"IT Support" +"Paul";"von D�niken";"pvondankiken";"!ttt&cqzWS";"pvondankiken@happykoalas.com";"IT";"IT Support" +"Hannah";"Hall";"hhall";"2cVyiWMJTc";"hhall@happykoalas.com";"Production";"Assembler" +"Kevin";"Jackson";"kjackson";"Ztw25st5ad";"kjackson@happykoalas.com";"Marketing";"SEO Manager" +"George";"Garcia";"ggarcia";"pmXfH3ok1h";"ggarcia@happykoalas.com";"IT";"Developer" +"Nina";"Smith";"nsmith";"6o#wafB&TH";"nsmith@happykoalas.com";"Production";"Supervisor" +"Xavier";"Lee";"xlee";"LGFd0uPb!Y";"xlee@happykoalas.com";"IT";"IT Support" +"Bob";"Clark";"bclark";"yx6PeTNjk5";"bclark@happykoalas.com";"Production";"Supervisor" +"Wendy";"Smith";"wsmith";"!ql9eEDSOs";"wsmith@happykoalas.com";"Marketing";"SEO Manager" +"Nina";"Anderson";"nanderson";"ZsKatKn4ci";"nanderson@happykoalas.com";"Finance";"Accountant" +"Xavier";"Walker";"xwalker";"oOyitvPewu";"xwalker@happykoalas.com";"Finance";"Financial Analyst" +"Uma";"Martinez";"umartinez";"%MhloQ6HKd";"umartinez@happykoalas.com";"Production";"Assembler" +"Rachel";"Walker";"rwalker";"Z5RanpFZrL";"rwalker@happykoalas.com";"RH";"Recruiter" +"Diana";"Lee";"dlee";"Z#%aVj1yaY";"dlee@happykoalas.com";"Production";"Operator" +"Yara";"Clark";"yclark";"9GwXEP1rFV";"yclark@happykoalas.com";"Production";"Supervisor" +"Oscar";"Walker";"owalker";"YN&bjDnt9C";"owalker@happykoalas.com";"Production";"Assembler" +"Uma";"Robinson";"urobinson";"&Ga!kKj5Gs";"urobinson@happykoalas.com";"Production";"Supervisor" +"Steve";"Martin";"smartin";"mpHRh2XKvb";"smartin@happykoalas.com";"Production";"Operator" +"Xavier";"Thomas";"xthomas";"Nq0JbT!t5r";"xthomas@happykoalas.com";"Production";"Assembler" +"Yara";"Brown";"ybrown";"W!Q9tVM&d#";"ybrown@happykoalas.com";"Production";"Operator" +"Laura";"Rodriguez";"lrodriguez";"x4dhjyXeiP";"lrodriguez@happykoalas.com";"IT";"IT Support" +"Paula";"Martinez";"pmartinez";"oO4AdhVY3d";"pmartinez@happykoalas.com";"Production";"Assembler" +"Hannah";"Martinez";"hmartinez";"efZBeiaDLa";"hmartinez@happykoalas.com";"Production";"Operator" +"Bob";"Harris";"bharris";"SlYl$4TqvE";"bharris@happykoalas.com";"Marketing";"SEO Manager" +"Laura";"Lewis";"llewis";"%8!tX#y23v";"llewis@happykoalas.com";"Marketing";"Marketing Specialist" +"Kevin";"Martinez";"kmartinez";"YdxKpjPM7%";"kmartinez@happykoalas.com";"Production";"Supervisor" +"Hannah";"Robinson";"hrobinson";"SaxU4bbR2e";"hrobinson@happykoalas.com";"Production";"Supervisor" +"Victor";"Johnson";"vjohnson";"se4wmlKOGd";"vjohnson@happykoalas.com";"Finance";"Accountant" +"Charlie";"Johnson";"cjohnson";"bDx$0c!GkS";"cjohnson@happykoalas.com";"Production";"Operator" +"Diana";"Taylor";"dtaylor";"B28BW6loy5";"dtaylor@happykoalas.com";"Production";"Assembler" +"Julia";"Garcia";"jgarcia";"uLId4ZA2Un";"jgarcia@happykoalas.com";"IT";"Developer" +"Victor";"Garcia";"vgarcia";"KOZbUvkU$m";"vgarcia@happykoalas.com";"Marketing";"Content Creator" +"Steve";"Brown";"sbrown";"dkze3n#Lvp";"sbrown@happykoalas.com";"Production";"Operator" +"Julia";"White";"jwhite";"sATTXSVui9";"jwhite@happykoalas.com";"IT";"Developer" +"Zack";"Smith";"zsmith";"Z4UaU!gz6x";"zsmith@happykoalas.com";"Production";"Assembler" +"Charlie";"Johnson";"cjohnson";"8g#JON&%RS";"cjohnson@happykoalas.com";"Production";"Assembler" +"Yara";"Walker";"ywalker";"QVhTWu6wgu";"ywalker@happykoalas.com";"Marketing";"Marketing Specialist" +"Evan";"Lewis";"elewis";"5D#7K%R%!g";"elewis@happykoalas.com";"Production";"Operator" +"Laura";"Smith";"lsmith";"jt7UVM7XhO";"lsmith@happykoalas.com";"Production";"Operator" +"Yara";"Martinez";"ymartinez";"Vp2YDhtv7N";"ymartinez@happykoalas.com";"Finance";"Accountant" +"Zack";"Jackson";"zjackson";"ACQgHZuA8H";"zjackson@happykoalas.com";"Production";"Supervisor" +"Bob";"Robinson";"brobinson";"3190KG%ny#";"brobinson@happykoalas.com";"Marketing";"Marketing Specialist" +"Wendy";"Harris";"wharris";"oXIHTDQUVk";"wharris@happykoalas.com";"Marketing";"Marketing Specialist" +"Wendy";"Thompson";"wthompson";"GM8evs9v4u";"wthompson@happykoalas.com";"IT";"IT Support" +"Paula";"Clark";"pclark";"FBLfHmsWkh";"pclark@happykoalas.com";"Production";"Supervisor" +"Fiona";"Smith";"fsmith";"#HUXKq7!xV";"fsmith@happykoalas.com";"Production";"Assembler" +"Fiona";"Martin";"fmartin";"rtjKJ47lZx";"fmartin@happykoalas.com";"RH";"Recruiter" +"Victor";"Robinson";"vrobinson";"BBFvPvnccD";"vrobinson@happykoalas.com";"Production";"Assembler" +"Julia";"Walker";"jwalker";"fT3N7fc%B4";"jwalker@happykoalas.com";"Production";"Supervisor" +"Hannah";"Thompson";"hthompson";"yxkH2SIGIF";"hthompson@happykoalas.com";"Production";"Operator" +"Fiona";"Taylor";"ftaylor";"qCRasZMT30";"ftaylor@happykoalas.com";"Production";"Assembler" +"Ian";"Martinez";"imartinez";"1Qk!%HUtRl";"imartinez@happykoalas.com";"Production";"Supervisor" +"Xavier";"Martin";"xmartin";"zVD#lasN3T";"xmartin@happykoalas.com";"Production";"Assembler" +"Hannah";"Lewis";"hlewis";"SmsPT$#17t";"hlewis@happykoalas.com";"Marketing";"Content Creator" +"Nina";"Robinson";"nrobinson";"Be!eizv76a";"nrobinson@happykoalas.com";"Production";"Operator" +"Nina";"Smith";"nsmith";"OpdUj7bq#j";"nsmith@happykoalas.com";"Production";"Supervisor" +"Hannah";"White";"hwhite";"8rcjxn&ijj";"hwhite@happykoalas.com";"Production";"Assembler" +"Nina";"Harris";"nharris";"LJ&klNXDR7";"nharris@happykoalas.com";"Production";"Operator" +"Wendy";"White";"wwhite";"Wq#jQWfVIq";"wwhite@happykoalas.com";"IT";"IT Support" +"George";"Garcia";"ggarcia";"Bqj5P9l1js";"ggarcia@happykoalas.com";"Finance";"Accountant" +"Uma";"Lee";"ulee";"IX0Ig9v2p%";"ulee@happykoalas.com";"Production";"Assembler" +"Bob";"Harris";"bharris";"5hoCKQD7h7";"bharris@happykoalas.com";"Production";"Supervisor" +"Steve";"Hall";"shall";"jdRxqlhNrJ";"shall@happykoalas.com";"Production";"Operator" +"Rachel";"Thompson";"rthompson";"xMp&$LZUd0";"rthompson@happykoalas.com";"Production";"Assembler" +"Alice";"Jackson";"ajackson";"Bn35XU&y3w";"ajackson@happykoalas.com";"Production";"Supervisor" +"Steve";"Jackson";"sjackson";"YZZtcYRpzz";"sjackson@happykoalas.com";"Production";"Assembler" +"Fiona";"Lee";"flee";"JDbsgWeNnt";"flee@happykoalas.com";"Production";"Supervisor" +"Ian";"Hall";"ihall";"9Dc2vs8Qbn";"ihall@happykoalas.com";"Production";"Operator" +"Zack";"Clark";"zclark";"fm13pQ4lYW";"zclark@happykoalas.com";"Production";"Supervisor" +"Yara";"Clark";"yclark";"65!or4ZC4u";"yclark@happykoalas.com";"Production";"Operator" +"Julia";"Thomas";"jthomas";"!X!4bEsKFT";"jthomas@happykoalas.com";"Marketing";"Content Creator" +"Tina";"Thomas";"tthomas";"VM6LVI5CgE";"tthomas@happykoalas.com";"Marketing";"SEO Manager" +"Zack";"Anderson";"zanderson";"IQ1LB#uv89";"zanderson@happykoalas.com";"Production";"Operator" +"Uma";"Lee";"ulee";"aCGXz251Nr";"ulee@happykoalas.com";"Marketing";"SEO Manager" +"Charlie";"Robinson";"crobinson";"3K4pcv%GH#";"crobinson@happykoalas.com";"Production";"Assembler" +"Uma";"White";"uwhite";"RouL63lqDl";"uwhite@happykoalas.com";"Marketing";"SEO Manager" +"Uma";"Anderson";"uanderson";"Akbwbjzaxg";"uanderson@happykoalas.com";"Finance";"Financial Analyst" +"Zack";"Martinez";"zmartinez";"yztH1RjSQT";"zmartinez@happykoalas.com";"Marketing";"SEO Manager" +"Charlie";"Jackson";"cjackson";"lxUyI#JBP!";"cjackson@happykoalas.com";"Production";"Supervisor" +"Victor";"Garcia";"vgarcia";"LLRYnZD9wr";"vgarcia@happykoalas.com";"Production";"Supervisor" +"Rachel";"Johnson";"rjohnson";"ML2buB&Mbw";"rjohnson@happykoalas.com";"Production";"Supervisor" +"Yara";"Robinson";"yrobinson";"!wkFKQ%Y2&";"yrobinson@happykoalas.com";"IT";"Developer" +"Xavier";"Lewis";"xlewis";"!RHESKuCDm";"xlewis@happykoalas.com";"Marketing";"Marketing Specialist" +"Alice";"Harris";"aharris";"LY0X5IS$Qt";"aharris@happykoalas.com";"IT";"Developer" diff --git a/insert_OUs.ps1 b/insert_OUs.ps1 new file mode 100644 index 0000000..bed8895 --- /dev/null +++ b/insert_OUs.ps1 @@ -0,0 +1,23 @@ +# Nom du script : insert_OUs.ps1 +Import-Module ActiveDirectory + +$csvPath = "happy_koalas_employees.csv" +$domainDN = (Get-ADDomain).DistinguishedName + +Write-Host "--- Création des Unités d'Organisation (OU) ---" -ForegroundColor Cyan + +# Lecture du CSV +$employees = Import-Csv -Path $csvPath -Delimiter ";" + +# On récupère la liste unique des départements +$departments = $employees | Select-Object -ExpandProperty Department -Unique + +foreach ($dept in $departments) { + # On vérifie si l'OU existe déjà pour éviter les erreurs rouges + if (-not (Get-ADOrganizationalUnit -Filter "Name -eq '$dept'")) { + New-ADOrganizationalUnit -Name $dept -Path $domainDN + Write-Host "[OK] OU créée : $dept" -ForegroundColor Green + } else { + Write-Host "[INFO] L'OU $dept existe déjà." -ForegroundColor Yellow + } +} \ No newline at end of file diff --git a/insert_users.ps1 b/insert_users.ps1 new file mode 100644 index 0000000..396a1f6 --- /dev/null +++ b/insert_users.ps1 @@ -0,0 +1,44 @@ +Import-Module ActiveDirectory + +$csvPath = "C:\Users\vboxuser\Desktop\Scripts\happy_koalas_employees.csv" +$domainDN = (Get-ADDomain).DistinguishedName + +Write-Host "--- Création des Utilisateurs dans l'AD ---" -ForegroundColor Cyan + +# 1. Lecture du CSV +$employees = Import-Csv -Path $csvPath -Delimiter ";" + +foreach ($user in $employees) { + # On définit l'OU de destination (ex: OU=IT,DC=domain,DC=local) + $targetOU = "OU=$($user.Department),$domainDN" + + # Vérification si l'OU existe (sécurité) + if (-not (Get-ADOrganizationalUnit -Filter "Name -eq '$($user.Department)'")) { + Write-Host "[ERREUR] L'OU $($user.Department) n'existe pas. Créez-la d'abord." -ForegroundColor Red + continue + } + + # Vérification si l'utilisateur existe déjà + if (-not (Get-ADUser -Filter "SamAccountName -eq '$($user.UserName)'")) { + + # Préparation du mot de passe au format sécurisé requis par l'AD + $securePassword = ConvertTo-SecureString $user.Password -AsPlainText -Force + + # Création de l'utilisateur + New-ADUser -Name "$($user.FirstName) $($user.LastName)" ` + -SamAccountName $user.UserName ` + -UserPrincipalName "$($user.UserName)@happykoalas.com" ` + -GivenName $user.FirstName ` + -Surname $user.LastName ` + -EmailAddress $user.Email ` + -Path $targetOU ` + -AccountPassword $securePassword ` + -ChangePasswordAtLogon $true ` + -Enabled $true ` + -Description $user.JobTitle + + Write-Host "[OK] Utilisateur créé : $($user.UserName) dans l'OU $($user.Department)" -ForegroundColor Green + } else { + Write-Host "[INFO] L'utilisateur $($user.UserName) existe déjà." -ForegroundColor Yellow + } +} \ No newline at end of file