How to Update Detection Method for a Win32 App Using Microsoft Graph?

August 12, 2025 2 answers
Asked by CicadaChorus
Hey everyone! I'm trying to update the detection method for a Win32 app using the Microsoft Graph API. I understand that the stable version doesn't support this feature, but the beta version does. As an Intune admin, I can manually update the detection method, and I've written a PowerShell script to automate this process. However, I'm running into a "400 Bad Request" error when I try to send an update request. Here's a quick overview of my script and the error I'm getting. Any insights or suggestions on how to resolve this issue would be greatly appreciated!

Answers

muddy galoshes
Additionally, make sure to include the rule type in your payload. Hereโ€™s a tweaked example of how you could structure your script detection: ```powershell $scriptDetection = @{ "@odata.type" = "#microsoft.graph.win32LobAppPowerShellScriptRule" ruleType = "detection" detectionType = "script" scriptContent = $encodedScript runAs32Bit = $true enforceSignatureCheck = $false } ``` This might resolve the validation failure you're encountering!

CicadaChorus: Thanks for the suggestion! I tried incorporating the rule type, but I'm still getting a similar "400 Bad Request" error. Itโ€™s frustrating!

Reply to this answer
3D mesh repair
It looks like the Invoke-MgGraph cmdlet operates independently and may not use the session created by Connect-MgGraph. I suggest testing by directly including an authentication token in your request. Have you looked into how to do that?

~small technical issue: I've encountered similar issues in the past. If you have details on how to retrieve the auth token, sharing that would be super helpful!

Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions