Updating your Offline Files cache in Windows Vista to point to a new server

A newsgroup customer recently asked us how to synchronize his Offline Files with a server after the server had been renamed. Offline Files in Windows Vista provides scripting support to enable users to write custom scripts to perform such tasks. To illustrate this, one of our Offline Files developers created a script that uses the “rename” functionality offered by the scripting model to rename the path in the local cache from the old server to the new server. 

I’ve added the script as a blog article. Use the following syntax to run the script on each affected client.

cscript CscRenameItem.vbs /OldItemPath:\oldserver /NewItemPath:\newserver

Some notes on this operation:

  • The script must be run on every client with data cached from the original server.  
  • The script doesn’t rename the item at the time it is run.  It merely records the “old” and “new” names.  A system restart is required to apply the change.  When the system is restarted, Offline Files renames the server entry in the local cache according to the parameters provided to the script.  Once the restart is complete, Offline Files will automatically synchronize the contents of the cache with the server of the new name.
  • This processing does not validate the existence of the “new” name provided.  If you provide the name of a server that does not exist, the affected files will remain in the Offline Files cache, unsynchronized with any server.  
  • Our example shows a rename for a server.  The UNC paths provided can also reference a shared folder.

You’ll need to restart Windows Vista after successfully running this script. After the restart, the files cached for \oldserver will now be cached for \newserver