Windowsserver

User Profile Cleanup

Download Cleanup-UserProfiles.ps1 Big environments get messy, lots of users, lots of admins, lots of logging in here and there. Profiles accumulate, C drive starts to get full, oh the humanity! Fear not humble Admin, on our adventures today we discover how to remove old user profiles with naught but the flick of a WMI method. The meat and bonse of this function is getting user profiles and deleting them: $userprofiles = Get-WmiObject -Class Win32_UserProfile $userprofiles[$whichOne].