Zum Hauptinhalt springen
In diesem Artikel wird detailliert beschrieben, wie überprüft wird, welche Windows 10-Geräte für ein Upgrade auf Windows 11 in Frage kommen und dieses Upgrade automatisch eingeleitet wird mithilfe von FleetDM-Richtlinien und PowerShell-Skripten. Das Verfahren umfasst:
  • Ermitteln und Speichern erforderlicher Systemkomponenten (TPM 2.0 und Secure Boot) in der Registrierung;
  • Validierung der Hardware- und Softwareanforderungen zur Bestimmung der Upgrade-Berechtigung;
  • Ausführen eines automatischen Downloads und einer unbeaufsichtigten Installation von Windows 11 auf kompatiblen Geräten.

1. Klassifizieren Sie Geräte mit TPM und Secure Boot

1.1. Erstellen Sie die Erkennungsrichtlinie (FleetDM-Registrierung)

Verwenden Sie die folgende Abfrage, um das Vorhandensein von Registrierungsschlüsseln zu überprüfen, die den TPM- und Secure Boot-Status speichern:
SELECT 1 WHERE EXISTS (
      SELECT 1 FROM registry
      WHERE path = 'HKEY_LOCAL_MACHINE\Software\FleetDM\TPMVersion'
    )
    AND EXISTS (
      SELECT 1 FROM registry
      WHERE path = 'HKEY_LOCAL_MACHINE\Software\FleetDM\SecureBoot'
    );

1.2. Führen Sie das zugehörige Skript aus (füllen Sie die Registrierung auf).

Hängen Sie dieses PowerShell-Skript an die obige Richtlinie an. Es erkennt die TPM-Version und den Secure Boot-Status und schreibt sie dann in die Windows-Registrierung für FleetDM.
$TPM = Get-WmiObject -Namespace "Root\CIMv2\Security\MicrosoftTpm" -Class Win32_Tpm
$SecureBoot = Confirm-SecureBootUEFI

$TPMVersion = $TPM.SpecVersion
$SecureBootEnabled = if ($SecureBoot) { 1 } else { 0 }

# Write values to the registry (example)
New-Item -Path "HKLM:\Software\FleetDM" -Force | Out-Null
Set-ItemProperty -Path "HKLM:\Software\FleetDM" -Name "TPMVersion" -Value $TPMVersion
Set-ItemProperty -Path "HKLM:\Software\FleetDM" -Name "SecureBoot" -Value $SecureBootEnabled
Erwartetes Ergebnis: HKLM\Software\FleetDM\TPMVersion und HKLM\Software\FleetDM\SecureBoot werden erstellt/aktualisiert.

2. Bewerten Sie die Eignung eines Windows 10-Geräts für Windows 11

Erstellen Sie die folgende Richtlinie, um Mindestanforderungen (RAM, CPU-Kerne, Architektur, TPM 2.0, Secure Boot) zu validieren und nicht konforme Geräte auszuschließen.
SELECT 1 FROM os_version as os JOIN system_info as si WHERE
    os.name NOT LIKE 'Microsoft Windows 10%'
    OR si.physical_memory < 4 * 1024 * 1024 * 1024
    OR si.cpu_physical_cores < 2
    OR si.cpu_type NOT LIKE '%x86_64%'
    OR NOT EXISTS (
      SELECT * FROM registry
      WHERE path = 'HKEY_LOCAL_MACHINE\Software\FleetDM\TPMVersion'
        AND data LIKE '2%'
    )
    OR NOT EXISTS (
      SELECT * FROM registry
      WHERE path = 'HKEY_LOCAL_MACHINE\Software\FleetDM\SecureBoot'
        AND data = '1'
    );
Interpretation: the query returns 1 if the device is not a compliant Windows 10. Use it as a non-compliance policy to keep only eligible devices (those for which the query does not return 1).

3. Lösen Sie das Windows 11-Upgrade aus (berechtigte Geräte).

Hängen Sie das Bereitstellungsskript unten an kompatible Geräte an. Es lädt das Windows 11 ISO herunter, mountet das Image, kopiert Quellen lokal und plant ein unbeaufsichtigtes Setup unter SYSTEM.
# Imports
Import-Module BitsTransfer

# Variables
$uri = "https://production-bucket-public-files.s3.eu-west-3.amazonaws.com/Win11_24H2_French_x64.iso" # French locale — replace with the appropriate locale ISO for your region
$destination = "C:\Win11.iso"
$log = "C:\logs\download_win11_iso.log"

# Create the logs folder if it doesn't exist
if (-not (Test-Path -Path "C:\logs")) {
    New-Item -Path "C:\logs" -ItemType Directory | Out-Null
}

# Start the download
try {
    "`n[$(Get-Date)] Starting download..." | Out-File -Append $log
    if (-not (Test-Path $destination)){
      Start-BitsTransfer -Source $uri -Destination $destination
    }
    "`n[$(Get-Date)] Download completed successfully." | Out-File -Append $log
} catch {
    "`n[$(Get-Date)] Error during download: $_" | Out-File -Append $log
}

# Additional variables
$isoPath = "C:\Win11.iso"
$setupFolder = "C:\Temp\Win11Files"
$taskName = "Win11SilentUpgrade"

# Step 1 - Mount the ISO
Mount-DiskImage -ImagePath $isoPath -PassThru | Out-Null
Start-Sleep -Seconds 2
$vol = Get-Volume -DiskImage (Get-DiskImage -ImagePath $isoPath)
$driveLetter = $vol.DriveLetter

# Step 2 - Copy ISO content locally
New-Item -ItemType Directory -Force -Path $setupFolder | Out-Null
Copy-Item "$driveLetter`:\*" -Destination $setupFolder -Recurse

# Unmount the ISO
Dismount-DiskImage -ImagePath $isoPath

# Step 3 - Create and schedule the installation task
$action = New-ScheduledTaskAction -Execute "C:\Temp\Win11Files\setup.exe" -Argument "/auto upgrade /migratedrivers none /resizerecoverypartition enable /dynamicupdate disable /eula accept /quiet /noreboot /uninstall disable /compat ignorewarning /copylogs C:\logs\WinSetup.log"
$principal = New-ScheduledTaskPrincipal -UserId "SYSTEM" -LogonType ServiceAccount -RunLevel Highest
$task = New-ScheduledTask -Action $action -Principal $principal -Trigger (New-ScheduledTaskTrigger -Once -At (Get-Date).AddMinutes(1))

Register-ScheduledTask -TaskName $taskName -InputObject $task -Force

# Step 4 - Start the task immediately
Start-ScheduledTask -TaskName $taskName