When scripting things it’s easy to make a typo. That’s why you’re supposed to test everything. But what about when you need to make a change to a script really quick? You know what you’re doing. You’ve done it 100s of times. No big deal right? Wrong.
Today I modified a script like I’ve done over and over. Only this time I copied and pasted a path, read though it, the whole nine yards. I ran the script and wiped a users system32 directory. At first I thought Whoa! This hard drive went bad? That’s not good! However when I had the user login to another computer and I ran the script again, I saw that it was deleting files in the system32 directory. BIG MISTAKE! I left the file name off of my path. So instead of DEL /Q %WINDIR%SYSTEM32FILE.DLL it was DEL /Q %WINDIR%SYSTEM32. Now I was screwed. Lucky for me I had a great idea. What if I just copied the system32 directory from another computer of the same model with a similar image on it? So I did this from winpe:
NET USE COMPUTERNAMEC$ /USER:[email protected] * ROBOCOPY COMPUTERNAMEC$WINDOWSSYSTEM32 C:WINDOWSSYSTEM32 /ZB /R:3 /W:3
Then I just waited for it to copy. Once that was done I booted the system and ran SFC /SCANNOW & Dial-A-Fix. When those were run I rebooted with GPUPDATE /FORCE /SYNC /TARGET:COMPUTER and I was done. Now you know how to fix a computer that you mess up without having to re-image it!