Update deviceManagementScriptState

Note: Using the Microsoft Graph APIs to configure Intune controls and policies still requires that the Intune service is correctly licensed by the customer.

Update the properties of a deviceManagementScriptState object.


One of the following scopes is required to execute this API:


HTTP Request

PATCH /deviceManagement/deviceManagementScripts/{deviceManagementScriptId}/runStates/{deviceManagementScriptStateId}

Request headers

Header Value
Authorization Bearer {token}. Required.
Accept application/json

Request body

In the request body, supply a JSON representation of a deviceManagementScriptState object. The following table shows the properties that are required when you create a deviceManagementScriptState.

Property Type Description
id String Key of the device management script state entity.
runState String State of latest run of the device management script. Possible values are: unknown, success, fail.
resultMessage String Details of execution output.
lastStateUpdateDateTime DateTimeOffset Latest time the device management script executes.


If successful, this method returns a 200 OK response code and an updated deviceManagementScriptState object in the response body.



Here is an example of the request.

PATCH https://graph.microsoft.com/beta/deviceManagement/deviceManagementScripts/{deviceManagementScriptId}/runStates/{deviceManagementScriptStateId}
Content-type: application/json
Content-length: 140

  "runState": "success",
  "resultMessage": "Result Message value",
  "lastStateUpdateDateTime": "2017-01-01T00:02:58.4418045-08:00"


Here is an example of the response. Note: The response object shown here may be truncated for brevity. All of the properties will be returned from an actual call.

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 255

  "@odata.type": "#microsoft.graph.deviceManagementScriptState",
  "id": "fbfa3cb8-3cb8-fbfa-b83c-fafbb83cfafb",
  "runState": "success",
  "resultMessage": "Result Message value",
  "lastStateUpdateDateTime": "2017-01-01T00:02:58.4418045-08:00"