Sometimes I see people removing user profiles by just going into explorer. Going to the %SystemDrive%\User
folder, and using delete. Well this worked perfect on Windows 2003. But with upgrades to the profiling system with Windows 2008 and later this is a really bad idea.
There are 2 basic ways to remove user profiles in Windows today. And one for the special people.
Click method:
- Control Panel
- System
- Advanced System Settings
- Settings on User Profiles
- Select profile
- Press Delete
Programmatically:
Fire up Powershell with administrative rights
Check out the SID for the account that you want to remove the profile for, then run:
Get-WmiObject win32_userprofile| Where-Object {$_.SID -eq 'S-1-5-21-1347639444-34920355641-2049490221-1001'} | ForEach {$_.Delete()}
Or just delete all unused profiles:
Get-WmiObject win32_userprofile| Where-Object {$_.Special -eq $False -and $_.Loaded -eq $False} | ForEach {$_.Delete()}
Wanna do it selfer:
- Start up Explorer
- Go to SystemDrive\Users
- Delete Folder
- Start RegEdit
- Go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList
- Delete key for SID of user