Get-MgmtGraphDeviceConfiguration
MgmtGraph: Audits Intune device configuration profiles
#Requires -Version 5.1
#Requires -Modules Microsoft.Graph.DeviceManagement
[CmdletBinding()]
Param (
[Parameter(Position = 0)]
[string]$Identity
)
Process {
try {
$params = @{
'ErrorAction' = 'Stop'
}
if ($Identity) {
$params.Add('DeviceConfigurationId', $Identity)
}
else {
$params.Add('All', $true)
}
$configs = Get-MgDeviceManagementDeviceConfiguration @params
$results = foreach ($c in $configs) {
[PSCustomObject]@{
DisplayName = $c.DisplayName
Description = $c.Description
Id = $c.Id
Version = $c.Version
LastModified = $c.LastModifiedDateTime
Created = $c.CreatedDateTime
Timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
}
}
Write-Output ($results | Sort-Object DisplayName)
}
catch {
throw
}
}Optional. Specifies the ID of the device configuration profile to retrieve. If omitted, all profiles are listed.