Disable old devices in Azure

%3CLINGO-SUB%20id%3D%22lingo-sub-3023318%22%20slang%3D%22en-US%22%3EDisable%20old%20devices%20in%20Azure%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3023318%22%20slang%3D%22en-US%22%3E%3CP%3EHello%3C%2FP%3E%3CP%3EI%20am%20running%20the%20below%20script%20to%20detect%20devices%20that%20are%20older%20than%2060%20days.%20What%20i%20dont%20understand%20is%20how%20can%20a%20device%20show%20as%20%22Dirsyncenabled%22%20%3D%20FALSE%2C%20but%20is%20found%20in%20the%20metaverse%20on%20the%20azure%20ad%20connect%20server%20%3F%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3E%23list%20all%20stale%20devices%0A%24dt%20%3D%20%5Bdatetime%5D'2021%2F10%2F01'%0Aget-azureaddevice%20-all%20%24true%20%7C%20where%20%7B%24_.ApproximateLastLogonTimeStamp%20-le%20%24dt%7D%20%7C%20select%20%60%0A%20%20%20%20objectid%2C%20deviceid%2C%20DisplayName%2CAccountEnabled%2CApproximateLastLogonTimeStamp%2CDeviceOSType%2CDeviceOSVersion%2C%20%60%0A%20%20%20%20%20%20%20%20DeviceTrustType%2CDirSyncEnabled%2CLastDirSyncTime%2CProfileType%20%7C%20export-csv%20.%5Caad_device_stale.csv%20-NoTypeInformation%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Factive-directory%2Fdevices%2Fmanage-stale-devices%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Factive-directory%2Fdevices%2Fmanage-stale-devices%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-3023318%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Frequent Contributor

Hello

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

https://docs.microsoft.com/en-us/azure/active-directory/devices/manage-stale-devices

0 Replies