Geräte-Tab: Autopilot Reset Aktion

Windows Autopilot Reset via wipe mit keepEnrollmentData:true.
Button nur bei Windows-Geräten sichtbar, separate Warnmeldung.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-08-12 14:31:59 +02:00
co-authored by Claude Sonnet 4.6
parent 78dc8d5c01
commit f94141dbe0
3 changed files with 22 additions and 8 deletions
+8 -3
View File
@@ -1622,13 +1622,18 @@ function Invoke-DeviceActionEndpoint {
if ($err) { return $err }
$action = [string]$Body.action
$allowed = @('syncDevice','rebootNow','remoteLock','collectDiagnostics','rotateBitLockerKeys','retire')
$allowed = @('syncDevice','rebootNow','remoteLock','collectDiagnostics','rotateBitLockerKeys','retire','autopilotReset')
if ($action -notin $allowed) {
return @{ statusCode = 400; error = "Unbekannte Aktion: $action" }
}
$uri = "https://graph.microsoft.com/v1.0/deviceManagement/managedDevices/$DeviceId/$action"
$bodyJson = '{}'
if ($action -eq 'autopilotReset') {
$uri = "https://graph.microsoft.com/v1.0/deviceManagement/managedDevices/$DeviceId/wipe"
$bodyJson = '{"keepEnrollmentData":true,"keepUserData":false}'
} else {
$uri = "https://graph.microsoft.com/v1.0/deviceManagement/managedDevices/$DeviceId/$action"
$bodyJson = '{}'
}
Invoke-MgGraphRequestRetry -Uri $uri -Method POST -Body $bodyJson -ContentType 'application/json' | Out-Null
return @{ success = $true; action = $action }
}