Posts

Showing posts from November, 2017

A.D. Group Policy "Delete user profiles older than a specified number days on system restart ” not working

Group policy for deleting old user profiles not working in Windows. We implemented the Active Directory Group Policy: “Delete user profiles older than a specified number days on system restart ” to clear old profiles older than 30 days from the PC. Unfortunately it doesn’t work, nothing gets deleted. I tracked this down to the setting it looks at for each profile: the “LastUseTime”. Something was changing the LastUseTime in NTUSER.DAT to today’s date for every user on the computer. Could be something in Windows or maybe our antivirus. Anyhow, it stopped the policy from working. You can check this with the PowerShell script: Get-WMIObject -class Win32_UserProfile | Where {(!$_.Special) -and ($_.ConvertToDateTime($_.LastUseTime) -lt (Get-Date).AddDays(-30))} (Thanks to Charlie Smith on Spiceworks for this) https://community.spiceworks.com/how_to/124316-delete-user-profiles-with-powershell Instead, use  the “LastDownloadTime” to check the date of profile download: Get-WMI