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 {