Suggestions on script to delete user profiles on multiple domain computers that have not logged on over 3 months. However it needs to avoid specific accounts even if they haven't logged on in 3 months(support/local admin accounts)
Olaf- the issue with DelProf2 is that since anti-virus scans folders it changes the date on the user folder to a more recent date. if i use the NTUSERINI switch then it deletes all accounts since ntuser.ini is used for roaming profiles and is created when the profile is created.
My vision is:
Get-WmiObject -Class Win32_UserProfile
for each domain computer that is reachable
(2) collect the LastLogonTimeStamp and LocalPath or UserName and convert to usable date/time
(a) list accounts to exclude(such as admin and Support accounts)
(b) list all accounts that haven't logged in for a specified length of time and delete