deviceHealthScriptDeviceState: How to retrieve deviceHealthScriptDeviceStateId and delete a deviceRunState?

Florian Rutishauser 0 Reputation points


  1. How do I retrieve the {deviceHealthScriptDeviceStateId} mentioned in

If I use the id from the value field retrievied via 'GET{deviceHealthScriptId}/deviceRunStates' and try to run 'GET{deviceHealthScriptId}/deviceRunStates/{deviceHealthScriptDeviceStateId}', I'll get that:

    "error": {
        "code": "No method match route template",
        "message": "No OData route exists that match template ~/singleton/navigation/key/navigation/key with http verb GET for request /DeviceFE/StatelessDeviceFEService/deviceManagement/deviceHealthScripts('deviceHealthScriptId')/deviceRunStates('id').",
        "innerError": {
            "date": "timestamp",
            "request-id": "someid",
            "client-request-id": "someotherid"
  1. And how do I delete an DeviceRunState mentioned in 'DELETE{deviceHealthScriptId}/deviceRunStates/{deviceHealthScriptDeviceStateId}' doesn't work.

Thanks for your help.

Best regards,

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,565 questions
Microsoft Intune
Microsoft Intune
A Microsoft cloud-based management solution that offers mobile device management, mobile application management, and PC management capabilities.
4,320 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Crystal-MSFT 42,801 Reputation points Microsoft Vendor

    @Florian Rutishauser, Thanks for posting in Q&A. To get the {deviceHealthScriptDeviceStateId}, we can query via the following method:

    Action: Get


    User's image

    Then we can get the "{deviceHealthScriptDeviceStateId" by looking at the id of your remediation script in the response.

    After that we can get the deviceHealthScriptDeviceState of the remediation script.

    User's image

    Hope the above information can help.

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

  2. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.

    Comments have been turned off. Learn more