Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invoke-IntuneManagedDeviceWipeDevice reporting back 400 Bad Request #51

Closed
patlewis-MSFT opened this issue Jul 2, 2019 · 3 comments
Closed

Comments

@patlewis-MSFT
Copy link

Running Invoke-IntuneManagedDeviceWipeDevice fails although working in Graph explorer.

Steps to repro:
Connect-MSGraph
$devices = Get-IntuneManagedDevice

Invoke-IntuneManagedDeviceWipeDevice -managedDeviceId $devices[].id -keepEnrollmentData $false -keepUserData $false -macOsUnlockCode "111111"

Failure:
Invoke-IntuneManagedDeviceWipeDevice : 400 Bad Request
{
"error": {
"code": "BadRequest",
"message": "{\r\n "_version": 3,\r\n "Message": "An error has occurred - Operation ID (for customer support): 00000000-0000-0000-0000-000000000000 - Activity ID: 13b1d9ee-b9d2-49c4-bff7-d7afd9dff0cb - Url:
https://fef.amsua0502.manage.microsoft.com/DeviceFE/StatelessDeviceFEService/deviceManagement/managedDevices%28%27b0fe8aa9-7d00-43f1-9ffb-1e2e5c2f66f3%27%29/microsoft.management.services.api.wipe?api-version=2018-05-24\",\r\n "CustomApiErrorPhrase":
"",\r\n "RetryAfter": null,\r\n "ErrorSourceService": "",\r\n "HttpHeaders": "{}"\r\n}",
"innerError": {
"request-id": "13b1d9ee-b9d2-49c4-bff7-d7afd9dff0cb",
"date": "2019-07-02T19:36:21"
}
}
}

Fiddler trace shows post going to same path as Graph Explorer which works.

Difference appears to be parameters sent are passed with Powershell SDK version and the authentication / authorization header is different with Powershell SDK

{
"keepEnrollmentData": false,
"keepUserData": false,
"macOsUnlockCode": "11111"
}

@patlewis-MSFT
Copy link
Author

I was able to reproduce this behavior also in Graph Explorer by adding the 3 parameters to the request body so it appears this is causing the problem. In the Powershell cmdlet there is no way to eliminate sending the parameters without a code change in cmdlet.

@rohitramu
Copy link
Contributor

@patlewis-MSFT Thank you for raising this issue! It has now been fixed in the latest version (6.1907.1.0) on the PowerShell Gallery. The "macOsUnlockCode" parameter is no longer mandatory.

@sujith-cy
Copy link

Today I was trying to run Invoke-IntuneManagedDeviceWipeDevice without macLockcode but it fails, please see screenshot below
maclookcode
please assist

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants