New-MgmtGraphDeviceCategory
MgmtGraph: Provisions a new Intune device category
#Requires -Version 5.1
#Requires -Modules Microsoft.Graph.DeviceManagement
[CmdletBinding()]
Param (
[Parameter(Mandatory = $true, Position = 0)]
[string]$DisplayName,
[string]$Description
)
Process {
try {
$params = @{
'DisplayName' = $DisplayName
'Confirm' = $false
'ErrorAction' = 'Stop'
}
if ($Description) { $params.Add('Description', $Description) }
$category = New-MgDeviceManagementDeviceCategory @params
$result = [PSCustomObject]@{
DisplayName = $DisplayName
Id = $category.Id
Status = "DeviceCategoryCreated"
Timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
}
Write-Output $result
}
catch {
throw
}
}Specifies the display name for the new device category.
Optional. Specifies a description for the new device category.