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

Update-mgdevicemanagementmanageddevice -devicecategory #145

Open
SamSepiolWarden opened this issue Aug 11, 2023 · 2 comments
Open

Update-mgdevicemanagementmanageddevice -devicecategory #145

SamSepiolWarden opened this issue Aug 11, 2023 · 2 comments

Comments

@SamSepiolWarden
Copy link

Does the cmdlet work ?
because can't make work with -bodyparameter or -devicecategory, eveytime he result with an error
$Params = @{ DeviceCategory = @{ "DisplayName" = "$NewCategory"} } | ConvertTo-Json try { # Changer la category Update-MgDeviceManagementManagedDevice -ManagedDeviceId $Device -BodyParameter $Params

@geoced
Copy link

geoced commented Oct 3, 2023

I cannot make it work either with the built-in cmdlets.

Update-MgBetaDeviceManagementManagedDevice -ManagedDeviceId $myIntuneDevice.Id -DeviceCategory $category
Update-MgBetaDeviceManagementManagedDevice : Cannot apply PATCH to navigation property 'deviceCategory' on entity type 'microsoft.management.services.api.managedDevice'.
Status: 400 (BadRequest)
ErrorCode: ModelValidationFailure
Date: 2023-10-03T17:24:51

Update-MgBetaDeviceManagementManagedDeviceCategory -ManagedDeviceId $myIntuneDevice.Id -Id $category.Id
Update-MgBetaDeviceManagementManagedDeviceCategory :
Status: 404 (NotFound)
ErrorCode: UnknownError
Date: 2023-10-03T17:03:16

The only way to make it work is like this:

$body = @{ '@odata.id' = "https://graph.microsoft.com/beta/deviceManagement/deviceCategories/$($category.Id)" }
Invoke-MgGraphRequest -Method PUT -Uri "beta/deviceManagement/managedDevices/$(myIntuneDevice.Id)/deviceCategory/`$ref" -Body $body

@SamSepiolWarden
Copy link
Author

This one work for me :

Update-MgBetaDeviceManagementManagedDeviceCategory -ManagedDeviceId $Device -BodyParameter $BodyParams

With the new category in the body parameter

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

2 participants