Fix Corrupted User's Profiles with PowerShell
By Michael J. Thomas
Troubleshooting a user's profile is sometimes hard to pin point out where the problem is and that is why a lot of us techs will use the technique of re-profiling the user's profile and copying just their data back. To do this process of re-profiling a user manually, I will demonstrate this process with a user account named Ed. I would do the following steps to fix his corrupted profile:
- Logoff Ed
- Login with an Admin Account
- Rename C:\Users\Ed to C:\Users\Ed.old
- Edit the Registry HKLM:\Software\Microsoft\Windows NT\CurrentVersion\ProfileListNow\SID and find Ed's SID and rename it to the SID.old.
- Logoff Admin Account
- Login Ed to Create a New Profile for him.
- Copy Ed's Data from Ed.Old Folder to his New User Profile.
I automated the process by creating a PowerShell Script that can fix it remotely. The script renames the user's profile to user.old, backups the user's registry key to windows temp folder, and rename's the SID in the registry to SID.old . The only thing I did not include in this script is to copy the user's data over to their new profile when they log back in. Don't worry, I will include that in a future version.
I hope you enjoy this weeks PowerShell Weekly Script!
|>_ Get-PowerShellWeekly Follow us by Email|