itgeek Posted November 24, 2022 Posted November 24, 2022 Hi, We have moved to local profiles and all was working well until I deleted the local profiles in the c:\users\username I think it put them in the registry profilelist. Is it possible to remove them in bulk on multiple machines? Thanks in advance
djm968 Posted November 24, 2022 Posted November 24, 2022 (edited) What you are trying to achieve? Local profiles are created in c:\users\%username% and if you delete these, it will break the profiles and you won't be able to log on, because the profile info is stored in the regkey below. Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList Edited November 24, 2022 by djm968
3s-gtech Posted November 24, 2022 Posted November 24, 2022 As above. If you've done this in bulk, you're going to have to script this to delete the keys for your users (avoiding ones you'll want to keep like Default User).
itgeek Posted November 24, 2022 Author Posted November 24, 2022 Hi, Yes that is what I have done delete the local profiles now I need a way to delete the reg keys. Does anyone have a script to do this? Thanks
djm968 Posted November 24, 2022 Posted November 24, 2022 (edited) A script using Delprof https://www.microsoft.com/en-gb/download/details.aspx?id=5405 would be better option. This will delete the profiles and remove the regkeys. You can also do this with a GPO (see below). Set the GPO to one or 2 days, and it will eventually clear out all older profiles, but I would set it for longer once old profiles have been cleared off all devices. Computer Configuration > Administrative Templates > System > User Profiles. https://learn.microsoft.com/en-us/answers/questions/441800/group-policy-how-to-automatically-delete-user-prof.html Edited November 24, 2022 by djm968
mavhc Posted November 24, 2022 Posted November 24, 2022 Get-CimInstance win32_userprofile -verbose | Where {$_.LastUseTime -lt $(Get-Date).Date.AddDays(-120)} | Remove-CimInstance -Verbose
Squip Posted November 25, 2022 Posted November 25, 2022 You can also do this with a GPO (see below). Set the GPO to one or 2 days, and it will eventually clear out all older profiles, but I would set it for longer once old profiles have been cleared off all devices. Computer Configuration > Administrative Templates > System > User Profiles. https://learn.microsoft.com/en-us/answers/questions/441800/group-policy-how-to-automatically-delete-user-prof.html This is what we do. Just be aware that the folders can take a little while to be deleted due to the sheer number of files within them (mostly in appdata). We had a machine with over 50 local pupil profiles, and it taken around 15 mins to delete them all in the background after applying the gpo and rebooting.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now