@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
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.
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.