Keeping Files in Sync in Windows 7

For any of you who know, it’s incredibly frustrating to use Windows 7’s Offline File synchronization capabilities.  While it does work, and it does keep files in sync, it does so in a weird, round-about way.

To start with, let’s look back at XP (I’m going to skip Vista, because I never used its file synchronization capabilities.  With XP, you would enable offline files for a specific directory.  You could then make changes to the files within that folder to your heart’s content.  Once you were done, you would simply log off of the computer, or shut down.  It was during this logoff process that the computer would then synchronize any changes from the remote folder to your computer, for offline viewing at a later time, if necessary.  It worked well, and people usually didn’t have a problem with it.

Imagine the following workflow:

  1. A user turns on his laptop, and connects to a network.
  2. The user then makes modifications to his folder on a remote location (a shared drive on a server, for example).
  3. At the end of the day, the user shuts down his laptop to go home for the night.
  4. During the shutdown process, the system syncs any changed files from the server to the user’s laptop.
  5. The user then takes the laptop home, and decides to do more work at home.
  6. The user opens up the computer, makes the changes to the offline files, and then shuts down.
  7. The next day the user comes back into the office, turns on the computer, and the files are automatically synchronized back to the server, once the computer detects that it’s connected back to that network.

Now, let’s look at Windows 7, and it’s unique, but critical difference to that of XP.  In Windows 7, the files no longer synchronize when the computer is shut down.  Rather, it synchronizes upon startup!  While this seems OK when you take into consideration the fact that you no longer need to wait for the synchronization to finish when you decide to shut down for the evening, you run into a problem when you try to actually do so.

Follow this scenario:

  1. A user turns on his computer and connects to the network.
  2. All files from the network are synchronized with his laptop that have been configured for offline access.
  3. The user then makes any changes to the files on the server.
  4. At the end of the day the user shuts down his computer to go home.
  5. The user takes the computer home, and decides to do some work in the evening.
  6. The user turns on the laptop, opens up his offline files, and sees that all of his changes that he made during the day are not there.  Crap!

You can quickly see that this is a problem.  Relying on the operating system to keep the files in sync with the files on the server no longer work properly.  Since it’s not synched except for on startup, you can no longer follow your traditional workflow.  Rather, you need to manually run the file synchronization before shutdown, to make sure that the files are synched.  This becomes a headache, because it requires user intervention every day.

And as we all are aware of, if it requires user intervention and manual process, it will never be done (at least it won’t be done during the instance that it needs to be done!).

So, what is the solution?

There are a number of various solutions that involve some complicated scripts, some scheduled tasks that you can create that would run at some arbitrary / triggered time, etc.  However, I’ve stumbled across a great solution that works like a champ, and makes me wonder why Microsoft didn’t configure it that way to begin with!

The solution?  A Group Policy Object!

This could be done as a setting on each specific computer you would like it changed on, individually (I think).  However, in my case, I went ahead and did it through our primary Windows Server (we run Active Directory, and manage all of our computers that way).

To do so, perform the following steps on your computer / server:

  1. Open up Group Policy Management (Start –> Administrative Tools –> Group Policy Management).
  2. Select a Group Policy Object that you are enforcing, and right-click it and select Edit.
  3. Navigate to the following location (Computer Configuration –> Policies –> Administrative Templates –> Network –> Offline Files).
  4. From here, select the “Synchronize all offline files before logging off” Setting, and double-click it to edit it.
  5. Select “Enabled”, and then OK to apply the setting.
  6. Back on your other computer, you may either wait until the group policy settings are pushed out, or you can force them immediately by opening a command prompt and typing “gpedit /force”.

That’s it!

Now, where I get a bit confused is Window’s description of what that setting is supposed to do:

Determines whether offline files are fully synchronized when users log off. […] If you enable this setting, offline files are fully synchronized. […]

Tip: To change the synchronization method without changing a setting, in Windows Explorer, on the Tools menu, click Folder Options, click the Offline Files tab […].

Now, here’s why I’m confused.  The setting itself is titled as though it has to do with logging off.  That is, it sees that one needs to perform the “logoff” action, at which time the system will sync the files, before fully logging on.  However, this does not seem to be the case.  Instead, it appears that it always maintains synchronization between the computer’s offline files, and the files on the server.

In this case, one could essentially make whatever changes he or she wished to the files on the server, and then IMMEDIATELY disconnect the computer from the network.  At this point, the files should already be in sync, and the user can already start working offline, since the files were synched.

This point seems to be reflected in the description of the setting, where it says that the files are “fully synchronized”.  I assume that to mean that they are always synched, and you don’t need to log on / log off in order to make it work.  However, the description also continues on to explain how to do it remotely, using Tools –> Folder Options –> Offline Files.  However, for the life of me on Windows 7, I couldn’t find “Offline Files”.  So, I’m not exactly sure what to believe in the description, and what not to believe!

As you can see, I don’t know why in the heck Microsoft didn’t decide to make this the default setting.  It makes complete sense to me to always have offline files synched with their respective target, and not rely on logon / logoff to perform the sync.  There are many use cases where a user may disconnect the computer from the network without performing either of those actions.  Why you wouldn’t want it to be automatically synched is beyond me.

Anyway, give this setting a shot, and it will fix your problems (and your user’s problems!) with Windows 7’s synchronization process.  No longer will you discover once you’re off the network, that you’re missing that critical file, or you don’t have the most recent changes on the file that you just worked on, that you need immediately.  (Presentations, anyone?)

Enjoy!

– Admin

2 thoughts on “Keeping Files in Sync in Windows 7

  1. RuudBoek

    Does this really work?
    Because the policy shows that it is supported on Windows Server 2003, Windows XP, and Windows 2000 operating systems only.
    So Windows 7 is not be supported.

    Reply
    1. Steven McKenzie Post author

      It’s been long enough since I’ve looked at this task, that I don’t remember a lot of the details about it. But yes, it really works. We had a user who constantly was complaining about files being out of sync, and didn’t like the fact that Windows only synced upon start up. It was too difficult for him to remember to log out and log back into his account before leaving to do work offsite, so that it would actually sync the files. (And rightly so! This made no sense to have to do this as a user, just to keep files in sync with being offline.)

      You’re right, the GPO appears to show that it only supports Windows Server 2K3, XP, and 2000. However, it does in fact work with Windows 7. I believe it’s an older, legacy GPO that they didn’t bother maintaining and keeping the description up to date with newer OS’s. This is probably also why it doesn’t appear to be worded in a way that makes it seem more understandable. But, I can assure you that it works as intended and as outlined in this entry.

      Give it a try!

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *