Categories
Server 2012 WIndows 8

Windows Server 2012 and Windows 8 Component Store

So a few times now I’ve come across a system that had a corrupted component store, usually by trying to run SFC /ScanNow and failing, whether it be by power loss, hard drive crash or other. I’ve found some good commands on how to attempt to repair the component store and thought I would put them here so I could find them easily.

First is how to manage and clean up your component store:

Dism.exe /Online /Cleanup-Image /AnalyzeComponentStore
Dism.exe /online /Cleanup-Image /StartComponentCleanup /ResetBase
Dism.exe /online /Cleanup-Image /SPSuperseded

The first command analyzes your store and tell you if a cleanup is needed, the second command does the cleanup (/ResetBase blocks the uninstallation of all SP’s and updates), and the third command removes all updates that are superseded by the latest installed SP.

Now to scan and repair the component store:

Dism /Online /Cleanup-Image /CheckHealth
Dism /Online /Cleanup-Image /ScanHealth
Dism /Online /Cleanup-Image /RestoreHealth

CheckHealth checks to see if a corruption marker already exists in the store, ScanHealth scans the store for corruption and RestoreHealth TRIES to fix the corruption.

Eightforums has great write ups on these commands and I recommend looking at them for more information:

DISM – Fixing Component Store Corruption in Windows 8

WinSxS Folder (Component Store) – Analyze in Windows 8.1

WinSxS Folder (Component Store) – Clean Up in Windows 8.1

Categories
Windows 7

Can’t delete long or deep folder path

For a while now I’ve been using a scheduled backup that copies my windows profile to my file server on a nightly basis. Well since I switched to Vista and now Windows 7 I’ve noticed something funky.

If you look in your C:\users\<username>\AppData\Local (hidden folder) folder you’ll notice an "Application Data" directory with an icon that looks like it’s a shortcut and that you have no rights to access. Well it seems the Microsoft in all it’s wisdom created a junction point here that basically points back to itself.

So what happens when you have a backup solution that overrides access denied and then attempts to copy this folder is that you copy itself into itself over and over again until you reach the windows folder depth limit and error out. You end up with something like this but MUCH deeper

 folders.jpg

Well I search for about an hour and finally found a solution on Windows IT Pro, JSI Tip 9651.

By using RobCopy, which is now part of Vista and Windows 7, this script will automatically delete the deep/long folder structure. If you’re not runing Vista or Windows 7, make sure a copy of RoboCopy.exe is in the same folder as the batch file.

Copy and paste this into notepad and save as DelFolder.bat. The syntax is DelFolder.bat <FolderPath>:

@echo off
if {%1}=={} @echo Syntax: DelFolder FolderPath&goto :EOF
if not exist %1 @echo Syntax: DelFolder FolderPath – %1 NOT found.&goto :EOF
setlocal
set folder=%1
set MT="%TEMP%\DelFolder_%RANDOM%"
MD %MT%
RoboCopy %MT% %folder% /MIR
RD /S /Q %MT%
RD /S /Q %folder%
endlocal

Categories
Vista

Turn off DEP on Windows Vista and NO BOOT.INI

If your used to turning DEP off completely on Windows XP you’ll have a hard time doing it on Vista.

The BOOT.INI file that is in Windows XP is now gone in Vista so you can’t just edit it to turn off DEP.

Windows Vista now comes with a command line tool called BCDEDIT.EXE that will edit the boot configs for you. It’s actually easier then editing the BOOT.INI file but only if you know the command to do it.

So here’s the command, make sure you run in with elevated priviledges.

Turn OFF DEP:
 

bcdedit.exe /set {current} nx AlwaysOff

Turn ON DEP:
 

bcdedit.exe /set {current} nx AlwaysOn

 

Categories
Windows

Replace Notepad with Notepad2

I find that Notepad2 from www.flos-freeware.ch is a vast improvment on the notepad that ships with Windows.

But as usual MS has made it very difficult to replace any system file so here’s a quick and easy way to replace your regular notepad with notepad2.

  1. First download Notepad2 and extract it.
  2. Rename notepad2.exe to notepad.exe
  3. Open Explorer and navigate to %systemroot%\ServicePackFiles\I386
  4. Rename notepad.exe in that folder to notepad.exe.old and copy the new notepad.exe
  5. Do the same for %systemroot%\system32\dllcache and %systemroot%\system32

You will need to ensure that you have "Display contents of system folders" and "Show hidden files and folders" checked and "Hide protected operating ssytem files" unchecked.

When you make the switch you may get a pop up warning you that some system files maybe be changed, just cancel and and your good to go.