Comments (11)
I found a work around to do the same thing.
Instead of using Update-DeviceManagement_ManagedDevices -managedDeviceId $id -deviceCategory $category
Or from the Preview Update-IntuneManagedDevice -managedDeviceId $id -deviceCategory $category
I used:
$DeviceID = "5d1ffe77-5767-45ef-8400-b7aa82e12591"
$DeviceCategory = '79891b7b-e26f-47ba-9e47-5a3dcf111e1d'
$uri = "https://graph.microsoft.com/beta/deviceManagement/managedDevices('$DeviceID')/deviceCategory/" + '$ref'
$JSON = @{ "@odata.id" = "https://graph.microsoft.com/beta/deviceManagement/deviceCategories/$DeviceCategory" } | ConvertTo-Json
Invoke-RestMethod -Uri $uri -Headers $authToken -Method Put -Body $JSON -ContentType "application/json"
Still not sure why Update-IntuneManagedDevice can't assign a category though.
from intune-powershell-sdk.
investigating..
from intune-powershell-sdk.
I'm having this same problem.
from intune-powershell-sdk.
In the documentation ManagedDevices un the Method "Update_DeviceManagement_ManagedDevices" it has System.Object deviceCategory as a parameter. As this is the only reference I could find that might be able to assign a Device category to a device.
I'm getting an error when trying to update this field for a device Using this command:
Update-DeviceManagement_ManagedDevices -managedDeviceId $id -deviceCategory $category
I also notice that deviceCategory wasn't specified in the Microsoft Graph REST API V1.0 or Beta documentation for Update managedDevice
Am I just missing something for the method call or it this a bug?
Thanks,
Johnathan
I see the same issue when trying to use Update-DeviceManagement_ManagedDevices when trying to update names on iOS devices. But using Invoke-Restmethod works fine so Its something wrong with the cmdlet.
from intune-powershell-sdk.
investigating..
Awesome, let us know if there's anything we can do to help.
from intune-powershell-sdk.
I confirm what @johnathanhall reported above. Since this route is not exposed in the v1.0 schema, the only way to set categories on IntuneManagedDevices is via direct Invoke-RestMethod to the beta route.
$uri = "https://graph.microsoft.com/**beta**/deviceManagement/managedDevices('$DeviceID')/deviceCategory/" + '$ref'
$JSON = @{ "@odata.id" = "https://graph.microsoft.com/beta/deviceManagement/deviceCategories/$DeviceCategory" } | ConvertTo-Json
Invoke-RestMethod -Uri $uri -Headers $authToken -Method Put -Body $JSON -ContentType "application/json"
from intune-powershell-sdk.
Update-IntuneManagedDevice -managedDeviceId $deviceID -deviceCategoryDisplayName $Displayname
Am also getting the same error. Any fix on this
from intune-powershell-sdk.
You can change the schema used by the module to "beta" by running the following command:
Update-MSGraphEnvironment -SchemaVersion 'beta'
After this, you should only use the Invoke-MSGraphRequest
cmdlet to make calls to Graph, since the standard (generated) cmdlets might not have the properties or entities you would like to use in the "beta" schema. Using the standard cmdlets (e.g. Update-IntuneManagedDevice
or Update-DeviceManagement_ManagedDevices
) might result in unexpected behavior. To achieve the same as @johnathanhall's example above, you can do the following:
# Get the device ID and device category ID to associate
$DeviceID = "5d1ffe77-5767-45ef-8400-b7aa82e12591"
$DeviceCategory = '79891b7b-e26f-47ba-9e47-5a3dcf111e1d'
# Create the request body which would associate the two objects
$requestBody = @{ "@odata.id" = "https://graph.microsoft.com/beta/deviceManagement/deviceCategories/$DeviceCategory" }
# Make the call to Graph which will create the association
Invoke-MSGraphRequest -HttpMethod PUT -Url "deviceManagement/managedDevices/$DeviceID/deviceCategory/`$ref" -Content $requestBody
from intune-powershell-sdk.
Small typo...for
Invoke-MSGraphRequest -HttpMethod PUT -Url "deviceManagement/managedDevices/$DeviceID/deviceCategory/`$ref" -Body $requestBody
should be -Content
, not -Body
from intune-powershell-sdk.
Oops, thanks for pointing that out @cmcapellan. I've fixed it now in the sample code.
from intune-powershell-sdk.
Still an issue on the cmdlet Update-MgDeviceManagementmanagedDevice or that was fixed ?
from intune-powershell-sdk.
Related Issues (20)
- New-IntuneRoleAssignment gives badrequest
- Get-IntuneManagedDevice returns all devices in a single result
- Get-IntuneDeviceConfigurationPolicy Encrypted omasettings
- Could not create IntuneAppProtectionPolicyiOS policy when assignments are provided HOT 2
- Get-IntuneMobileApp and Get-DeviceAppManagement_MobileApps not retrieving macOS LoB Apps
- This repo is missing important files HOT 2
- Where is Disconnect-MSGraph? HOT 1
- Get-AADGroupmember doesn't work on groups that have a source of Windows Server AD HOT 1
- Exclude Microsoft Intune PowerShell from Compliance Policy
- Security & Compliance Center connection error
- Exchange Online Prerequisite Check Failure HOT 1
- Unable to Connect-msgraph using client secret or cert
- Error on Invoke-IntuneManagedDeviceSyncDevice
- Error on New-MgDeviceManagementDeviceEnrollmentConfiguration HOT 1
- H
- Connect Graph issues
- Get-IntuneMobileApp Productversion parameter shows the wrong data
- Update-mgdevicemanagementmanageddevice -devicecategory HOT 1
- 504 Gateway Timeout when using Get-IntuneManagedDevice | Get-MSGraphAllPages HOT 1
- Assignments missing from get-intunemobileapp output
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from intune-powershell-sdk.