Did you update the $TPMInvokeURL = 'deviceManagement/deviceHealthScripts/<guid>/deviceRunStates?' variable to include the specific GUID of the Pro-Active Remediation script?
Use the following command to retrieve the GUIDs of the proactive Remediation scripts in your environment
(Invoke-MSGraphRequest -HttpMethod GET -url "deviceManagement/deviceHealthScripts/").value | select id,displayname
Can it be used to retrieve all the deployment status for a proactive remediation?
Thank you for this script but I'm having issues connecting to the URL during the invoke-msgraphrequest.
error:
Invoke-MSGraphRequest : Cannot validate argument on parameter 'Url'. The provided URL is not valid - the URL may be a relative URL
At line:23 char:64
+ ... MEKResults = Invoke-MSGraphRequest -HttpMethod GET -Url $TPMInvokeURL
+ ~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Invoke-MSGraphRequest], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.Intune.PowerShellGraphSDK.PowerShellCmdlets.InvokeRequest
Thank you
Did you update the $TPMInvokeURL = 'deviceManagement/deviceHealthScripts/<guid>/deviceRunStates?' variable to include the specific GUID of the Pro-Active Remediation script?
Use the following command to retrieve the GUIDs of the proactive Remediation scripts in your environment
(Invoke-MSGraphRequest -HttpMethod GET -url "deviceManagement/deviceHealthScripts/").value | select id,displayname
Apologies I should have put that in the article
I had not, once I gathered the GUID with the above line, it worked. Thank you for sharing you work.