Get-MgmtGraphManagedDeviceDetail
MgmtGraph: Lists Intune managed devices for selection
#Requires -Version 5.1
#Requires -Modules Microsoft.Graph.DeviceManagement
[CmdletBinding()]
Param ()
Process {
try {
$devices = Get-MgDeviceManagementManagedDevice -All -ErrorAction Stop
$results = foreach ($d in $devices) {
[PSCustomObject]@{
DeviceName = $d.DeviceName
Id = $d.Id
UserPrincipalName = $d.UserPrincipalName
Timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
}
}
Write-Output ($results | Sort-Object DeviceName)
}
catch {
throw
}
}This script has no configurable parameters.