Téléverser les fichiers vers "/"

This commit is contained in:
2026-01-27 09:27:44 +00:00
commit 65b7d5461b
5 changed files with 347 additions and 0 deletions

28
generate_passwords.ps1 Normal file
View File

@@ -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<6E>es en m<>moire
# On utilise une variable ($data) pour lib<69>rer le fichier apr<70>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<><52>crire par-dessus le fichier original
$data | Export-Csv -Path $path -NoTypeInformation -Delimiter ";" -Encoding utf8
Write-Host "Le fichier original a <20>t<EFBFBD> mis <20> jour avec succ<63>s !" -ForegroundColor Cyan