Disable old devices in Azure

Iron Contributor


I am running the below script to detect devices that are older than 60 days. What i dont understand is how can a device show as "Dirsyncenabled" = FALSE, but is found in the metaverse on the azure ad connect server ?

#list all stale devices
$dt = [datetime]'2021/10/01'
get-azureaddevice -all $true | where {$_.ApproximateLastLogonTimeStamp -le $dt} | select `
    objectid, deviceid, DisplayName,AccountEnabled,ApproximateLastLogonTimeStamp,DeviceOSType,DeviceOSVersion, `
        DeviceTrustType,DirSyncEnabled,LastDirSyncTime,ProfileType | export-csv .\aad_device_stale.csv -NoTypeInformation


1 Reply

@Skipster311-1 Device Write-Back option perhaps?