From 1c94421382cf57de1743042de7141bceaab764cd Mon Sep 17 00:00:00 2001 From: Esco Date: Fri, 15 Nov 2024 13:11:48 +0100 Subject: [PATCH] fix: fix device wipe action --- .../Endpoint/MEM/Invoke-ExecDeviceAction.ps1 | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-ExecDeviceAction.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-ExecDeviceAction.ps1 index ca788cb979da..d168060b4abf 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-ExecDeviceAction.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-ExecDeviceAction.ps1 @@ -20,7 +20,19 @@ Function Invoke-ExecDeviceAction { if ($Request.Query.Action -eq 'setDeviceName') { $ActionBody = @{ deviceName = $Request.Body.input } | ConvertTo-Json -Compress } - $ActionResult = New-CIPPDeviceAction -Action $Request.Query.Action -ActionBody $ActionBody -DeviceFilter $Request.Query.GUID -TenantFilter $Request.Query.TenantFilter -ExecutingUser $request.headers.'x-ms-client-principal' -APINAME $APINAME + else { + $ActionBody = $Request.Body | ConvertTo-Json -Compress + } + + $cmdparams = @{ + Action = $Request.Query.Action + ActionBody = $ActionBody + DeviceFilter = $Request.Query.GUID + TenantFilter = $Request.Query.TenantFilter + ExecutingUser = $request.headers.'x-ms-client-principal' + APINAME = $APINAME + } + $ActionResult = New-CIPPDeviceAction @cmdparams $body = [pscustomobject]@{'Results' = "$ActionResult" } } catch {