Remove-MgmtGraphDeviceCategory
MgmtGraph: Deletes an Intune device category
#Requires -Version 5.1
#Requires -Modules Microsoft.Graph.DeviceManagement
[CmdletBinding()]
Param (
[Parameter(Mandatory = $true, Position = 0)]
[string]$Identity
)
Process {
try {
$params = @{
'DeviceCategoryId' = $Identity
'Confirm' = $false
'ErrorAction' = 'Stop'
}
Remove-MgDeviceManagementDeviceCategory @params
$result = [PSCustomObject]@{
Id = $Identity
Action = "DeviceCategoryRemoved"
Status = "Success"
Timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
}
Write-Output $result
}
catch {
throw
}
}Specifies the ID of the device category to remove.