Ajout dela structure MDT dans Infra-LAB

This commit is contained in:
2026-05-24 16:21:20 +02:00
parent fed8d42171
commit 049b03b4d4
522 changed files with 105109 additions and 0 deletions
@@ -0,0 +1,22 @@
# Script de génération des fichiers Key.txt et mots de passe chiffrés
$Scriptlocation = Split-Path -Path $MyInvocation.MyCommand.Path
# Générer une clé aléatoire (24 octets pour 192 bits)
$keyBytes = New-Object Byte[] 24
[Security.Cryptography.RNGCryptoServiceProvider]::Create().GetBytes($keyBytes)
$keyString = [Convert]::ToBase64String($keyBytes)
$keyString | Out-File "$Scriptlocation\Key.txt" -Encoding UTF8
# Mot de passe commun
$password = "crhdf!@2026"
# Utilisateurs à traiter
$users = @("supporthdf", "adminlyc")
foreach ($user in $users) {
# Chiffrer le mot de passe avec la clé
$encryptedPassword = ConvertTo-SecureString $password -AsPlainText -Force | ConvertFrom-SecureString -Key $keyBytes
$encryptedPassword | Out-File "$Scriptlocation\$user-CryptPwd.txt" -Encoding UTF8
}
Write-Host "Fichiers générés : Key.txt et fichiers chiffrés pour supporthdf et adminlyc"