Ajout de la configuration de paritionnement des disques
This commit is contained in:
1 parent
7c724d475e
commit
e388cdca45
9 files changed
+450
-123
No files matched your search
+25
-6
@@ -9,17 +9,36 @@ function Get-DeployNetworkIPv4 {
|
||||
# APIPA et adresses IPv4 non routables couramment inutiles en WinPE.
|
||||
$candidates = @()
|
||||
try {
|
||||
foreach ($cfg in (Get-CimInstance Win32_NetworkAdapterConfiguration -Filter 'IPEnabled=True' -ErrorAction Stop)) {
|
||||
$hasGateway = @($cfg.DefaultIPGateway | Where-Object { $_ -match '^\d{1,3}(\.\d{1,3}){3}$' }).Count -gt 0
|
||||
foreach ($address in @($cfg.IPAddress | Where-Object { $_ -match '^\d{1,3}(\.\d{1,3}){3}$' })) {
|
||||
if ($address -eq '127.0.0.1' -or $address -like '169.254.*' -or $address -eq '0.0.0.0') { continue }
|
||||
$candidates += [pscustomobject]@{ Address = $address; HasGateway = $hasGateway; Index = [int]$cfg.Index }
|
||||
foreach ($interface in [System.Net.NetworkInformation.NetworkInterface]::GetAllNetworkInterfaces()) {
|
||||
if ($interface.NetworkInterfaceType -eq [System.Net.NetworkInformation.NetworkInterfaceType]::Loopback) { continue }
|
||||
|
||||
$properties = $interface.GetIPProperties()
|
||||
$ipv4Properties = $properties.GetIPv4Properties()
|
||||
if ($null -eq $ipv4Properties) { continue }
|
||||
|
||||
$hasGateway = @(
|
||||
$properties.GatewayAddresses | Where-Object {
|
||||
$_.Address.AddressFamily -eq [System.Net.Sockets.AddressFamily]::InterNetwork -and
|
||||
$_.Address.ToString() -ne '0.0.0.0'
|
||||
}
|
||||
).Count -gt 0
|
||||
|
||||
foreach ($unicast in $properties.UnicastAddresses) {
|
||||
$address = $unicast.Address
|
||||
if ($address.AddressFamily -ne [System.Net.Sockets.AddressFamily]::InterNetwork) { continue }
|
||||
$addressText = $address.ToString()
|
||||
if ($addressText -eq '127.0.0.1' -or $addressText -like '169.254.*' -or $addressText -eq '0.0.0.0') { continue }
|
||||
$candidates += [pscustomobject]@{
|
||||
Address = $addressText
|
||||
HasGateway = $hasGateway
|
||||
Index = [int]$ipv4Properties.Index
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
# La détection réseau ne doit pas empêcher le démarrage de DeployCenter.
|
||||
if (Get-Command Write-Log -ErrorAction SilentlyContinue) {
|
||||
Write-Log "Détection réseau WMI : $($_.Exception.Message)" 'WARNING'
|
||||
Write-Log "Détection réseau : $($_.Exception.Message)" 'WARNING'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user