Ajout de la partie application des changements sur le disque

Ajout de l'installation de Windows
Correction du chargement des images iso.
Correction de la définition de la taille de WinRE.
This commit is contained in:
benoit committed 2026-10-17 03:56:53 +02:00
1 parent 1c67cb2630
commit 8d5014b4aa
13 files changed
+2524 -1445

No files matched your search

+4 -101
View File
@@ -1,101 +1,4 @@
# HardwareInfo.ps1
# DeployCenter - Inventaire matériel
# Compatible Windows PowerShell 5.1 / WinPE
function Get-HardwareInfo {
[CmdletBinding()]
param()
$info = [ordered]@{
Manufacturer = "Inconnu"
Model = "Inconnu"
SerialNumber = "Inconnu"
Firmware = "Inconnu"
Architecture = $env:PROCESSOR_ARCHITECTURE
WinPE = $false
Disks = @()
Errors = @()
}
# Fabricant et modele du PC
try {
$computer = Get-CimInstance `
-ClassName Win32_ComputerSystem `
-ErrorAction Stop
if ($computer.Manufacturer) {
$info.Manufacturer = $computer.Manufacturer.Trim()
}
if ($computer.Model) {
$info.Model = $computer.Model.Trim()
}
}
catch {
$info.Errors += "Modele du PC : $($_.Exception.Message)"
}
# Numero de serie
try {
$bios = Get-CimInstance `
-ClassName Win32_BIOS `
-ErrorAction Stop
if ($bios.SerialNumber) {
$info.SerialNumber = $bios.SerialNumber.Trim()
}
}
catch {
$info.Errors += "Numero de serie : $($_.Exception.Message)"
}
# Detection du firmware
try {
$firmwareKey = Get-ItemProperty `
-Path "HKLM:\SYSTEM\CurrentControlSet\Control" `
-Name PEFirmwareType `
-ErrorAction Stop
switch ([int]$firmwareKey.PEFirmwareType) {
1 { $info.Firmware = "BIOS (Legacy)" }
2 { $info.Firmware = "UEFI" }
default { $info.Firmware = "Indetermine" }
}
}
catch {
$info.Errors += "Mode firmware indisponible"
}
# Detection de WinPE
$info.WinPE = Test-Path `
"HKLM:\SYSTEM\CurrentControlSet\Control\MiniNT"
# Inventaire des disques physiques
try {
$disks = @(Get-Disk -ErrorAction Stop)
foreach ($disk in $disks) {
$operationalStatus = @($disk.OperationalStatus | ForEach-Object { [string]$_ } | Where-Object { -not [string]::IsNullOrWhiteSpace($_) })
$status = if ($operationalStatus.Count -gt 0) { $operationalStatus -join ', ' } else { 'Inconnu' }
$info.Disks += [PSCustomObject]@{
Index = [int]$disk.Number
Model = [string]$disk.FriendlyName
SizeBytes = [long]$disk.Size
SizeGB = [math]::Round(
([double]$disk.Size / 1GB), 1
)
BusType = [string]$disk.BusType
Status = $status
HealthStatus = [string]$disk.HealthStatus
}
}
}
catch {
$info.Errors += "Inventaire des disques : $($_.Exception.Message)"
}
# Retourner un objet exploitable par les autres modules
[PSCustomObject]$info
}
# Point d'entrée historique conservé pour les appels directs à HardwareInfo.ps1.
$hardwareInventoryModule = Join-Path $PSScriptRoot 'Modules\HardwareInventory.psm1'
Import-Module $hardwareInventoryModule -Force
Get-HardwareInfo