Using the Group Policy setting – Delete user profiles older than a specified number of days on system restart, you can now delete old User profiles and files automatically in Windows 10/8/7. This policy setting allows an administrator to automatically delete user profiles on system restart that have not been used within a specified number of days after a specific user profile was accessed. You may need to do this if you are working in an environment where there are many users who come, create a user profile, use the system for a while and go away – like say an academic instution or a work place – and you dont want unused user profiles clogging your system.
Delete user profiles older than a specified number of days on system restart
To configure this setting, type gpedit.msc in start search and hit Enter to open the Group Policy Editor. Next navigate to:
Computer Configuration, expand Administrative Templates > System > User Profiles.
Now in the right-hand side details pane, double-click on Delete user profiles older than a specified number of days on system restart to open its configuration box.
Here, if you enable this policy setting, the User Profile Service will automatically delete on the next system restart all user profiles on the computer that have not been used within the specified number of days.
If you disable or do not configure this policy setting, User Profile Service will not automatically delete any profiles on the next system restart.
Hope this helps.