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:
+8
-3
@@ -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 }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user