Skip to content

Get-MgmtGraphManagedDeviceCategory

MgmtGraph: Audits the category for a managed device

#Requires -Version 5.1
#Requires -Modules Microsoft.Graph.DeviceManagement

[CmdletBinding()]
Param (
    [Parameter(Mandatory = $true, Position = 0)]
    [string]$Identity
)

Process {
    try {
        $category = Get-MgDeviceManagementManagedDeviceCategory -ManagedDeviceId $Identity -ErrorAction Stop
        
        $result = [PSCustomObject]@{
            DeviceId    = $Identity
            DisplayName = $category.DisplayName
            Description = $category.Description
            Id          = $category.Id
            Timestamp   = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
        }

        Write-Output $result
    }
    catch {
        throw
    }
}

Specifies the ID of the managed device.

An interactive directory of PowerShell scripts.