In this article, we will learn how we can use group policy to delete old user profile after specific time duration in which user haven’t logged into the system. As every profile created on any system takes some space on its hard drive.
Let’s suppose you are working in any organization as an IT support engineer which has employees who are working on different shifts but they are sharing the system to do their office work and you observe that you are getting tickets related to system slowness so the first thing which everyone does during catering the system slowness is to clean up the drive which contains the operating system.
If one system has so many profiles created on it then it can be one of the main reason for system slowness. Your manager comes to you and asks you to delete the old user profiles from each system after specific time since your manager knows that no user is keeping the office data in their profile so it would become a hectic job to delete each user profiles one by one.
There is a solution for that you just have to enable the group policy using windows server so log into the windows server as I will be using windows server 2012 R2 as an example. Open the server manager and click on tools to select the group policy management.
Once group policy management window console is opened, right-click on “Default domain policy” and click “edit”
It will open up group policy management editor window console, expand policies under computer configuration.
Expand “System” under administrative policies.
Scroll down and select “User Profiles”
Select “delete user profiles older than specified number of days on system restart” and click on it open it
Click “enable” and then enter the number of days which you want to set. Let’s say we want to delete all the profiles which haven’t logged on to the system from last 7 days so we will enter the value “7” in “delete user profiles older than (days)” and click apply for the policy to be enabled and it will delete all the profiles once system is restarted.
This is how you can delete all the old profiles by enabling the group policy.