deviceHealthScriptDeviceState: How to retrieve deviceHealthScriptDeviceStateId and delete a deviceRunState?

Florian Rutishauser 0 Reputation points
2024-03-19T10:29:00.8666667+00:00

Hello

  1. How do I retrieve the {deviceHealthScriptDeviceStateId} mentioned in https://learn.microsoft.com/en-us/graph/api/intune-devices-devicehealthscriptdevicestate-get?view=graph-rest-beta?

If I use the id from the value field retrievied via 'GET https://graph.microsoft.com/beta/deviceManagement/deviceHealthScripts/{deviceHealthScriptId}/deviceRunStates' and try to run 'GET https://graph.microsoft.com/beta/deviceManagement/deviceHealthScripts/{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 https://learn.microsoft.com/en-us/graph/api/intune-devices-devicehealthscriptdevicestate-delete?view=graph-rest-beta? 'DELETE https://graph.microsoft.com/beta/deviceManagement/deviceHealthScripts/{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.
11,459 questions
Microsoft Intune
Microsoft Intune
A Microsoft cloud-based management solution that offers mobile device management, mobile application management, and PC management capabilities.
4,743 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Crystal-MSFT 46,271 Reputation points Microsoft Vendor
    2024-03-20T02:08:20.5266667+00:00

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

    Action: Get

    URL:https://graph.microsoft.com/beta/deviceManagement/deviceHealthScripts

    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