Backtrack:  
 
by lunarg on November 5th 2012, at 17:40

When using offline files/folders, it sometimes goes very wrong, leaving the whole sync of offline files in an unusable state. I personally had problems with a lot of clients that used this feature. In theory, it works nicely, but every now and then, it's prone to go very bad.

The biggest issue is that as a user, you don't really have much control on the whole process, making it difficult to adequately resolve problems. And when it does go wrong, even what little you still can configure and change, becomes inaccessible, resulting in an offline files system that's completely dead.

Luckily, there is a way to quickly resolve the matter. With a simple registry value in the Windows Registry, you can completely reset the offline files cache and settings to a pristine state. The only thing to take notice of, is that all offline files you have (including changes you may have made locally) will be gone. But, because when reading this, the offline files system probably has already gone (almost) entirely south, you probably wouldn't mind it.

The solution

You can ask the Offline Files service (called CSC) to completely reset and clear the Offline Files system. This is done by adding a certain registry value to the Windows Registry, and then reboot the computer.

Vista / Windows 7
  1. Start regedit, navigate to the key HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\CSC\Parameters.
    If Parameters doesn't exist create it as a key.
  2. Create a new REG_DWORD value called FormatDatabase. Set its value to 1.
  3. Exit, then reboot your computer.
2000 / XP
  1. Start regedit, navigate to the key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\NetCache
  2. Create a new REG_DWORD value called FormatDatabase. Set its value to 1.
  3. Exit, then reboot your computer.

Upon rebooting your computer, the offline files database, cache and temporary files will all have been cleared, as well as all synchronisation relationships. It's like you start with a pristine offline files configuration. If needed, you can now re-add the folders and files you want to have offline, and let it synchronize anew.

Notice
You will lose all unsychronized changes to the local offline files.
If you have data that you want to keep, continue reading below.

Rescuing local changes

If you still have some local changes left in your offline files folders, but are unable to sync them to the original location, you can either copy them to another location on your local drive (securing them), and avoid losing all the hard work. The problem with this is that you'll have to figure out what has changed, although, that doesn't have to be much of a hassle...

A solution to this is using robocopy, a very powerful copy and sync tool (somewhat similar to rsync), designed by Microsoft, but not often documented. For Vista and up, robocopy is available by default. For older releases, download the Resource Kit Tools from the install CD or the Microsoft Downloads website.

With this tool, you can compare and sync two folders and have the destination folder (and subfolders) get updated by the contents of the source folder. In our case, you would use robocopy in this fashion.

robocopy "C:\my rescued data\ " "\\my-server\share\online data\ " /MIR /NDL /NP /R:0 /W:1

Before actually running this command, you can do a dry run by adding /L as a parameter as well. This will show what robocopy will do, but won't actually do it. Also note the space between the last backslash and the closing quotes. This is necessary as the backslash would otherwise escape the closing quotes (this is DOS 101).

This method allows you to rescue your unsynchronized changes, and manually have them synced back to the online location.

Sources and more info in KB230738 (XP and earlier), and KB942974 (Vista / 7).