Repair Computer Script - WMI,MSI, Permissions, Catroot2
Occasionally you will find computers in your environment that become almost unusable. Registry and file permissions become either so tight, or they are set incorrectly, that applications will not install or error out. WMI and MSI become corrupt and everything seems to fail. Most times re-imaging is the only option since it is faster to re-image than sift through thousands of registry and file permissions.
Attached is a batch file that repairs:
CATROOT2 – If corrupt, Microsoft Patches will not install.
Resets all file and registry permission back to the default XP settings.
This batch file has saved me numerous hours of troubleshooting, and has been run on hundreds of computers without issues. It can be scheduled via LANDesk, or on more desperate cases, run via Psexec.
It was written in batch since it is one of the lowest common scripting languages (so it should run even if the computer is not in a stable state).
Test this before running in your environment! It is safe, however, it does reset registry and file permissions. If any custom registry or file permission were set on “standard” keys/folders, they will be reset. Also when file permissions are reset, it creates a lot of file I/O and Virus Scanning apps may consume more CPU cycles.
I have also had to run it twice on some machines that were in bad shape.