Windows RT and Offline Files
On October 26th I went out and got myself a new shiny 64GB Microsoft Surface with the TouchPad. I plan to write up a post on what I think of it in my day to day use but I want to give it a bit more time. This post is about one of those places where Microsoft reminds you that this is not exactly Windows: Offline Files.
For those who donāt know what Offline Files are Microsoft has this description on their website:
Using offline files, you can access files stored in shared network folders even when the network copies are unavailable. You can do this by choosing the network files you want to make available offline, which automatically creates a copy of the network files on your computer. These copies of network files that are stored on your computer are called offline files. Windows will automatically sync your offline files for you and open them whenever the network versions are unavailable.
http://windows.microsoft.com/en-US/windows-vista/Understanding-offline-files
On my laptop I use Offline Files so that my music collection, which I store on my home server, is accessible even when Iām not on my home network. Since my Surface is also a mobile device, even more so in fact since my laptop is a 17 gaming machine, I wanted to use it there too. The problem is that for reasons that I donāt know Microsoft removed Offline Files from Windows RT. After fiddling around a bit Iāve found a āhackā to replicate Offline Files.
Some warning first though:
While this hack doesnāt modify the registry its still not for the average user. Iām working on making it easier to use but itās not there yet.
This can impact battery life, how Iām not sure yet (still testing) so be careful.
This hack is based on two lovely features of Windows that Microsoft didnāt remove: RoboCopy and Scheduled Tasks. RoboCopy is an extremely advanced folder (not file) copying command line too. Iām not going to go in to all itās features just the ones used in this hack. If you want more information you can look at the Official TechNet Documentation or Robocopy and a Few Examples. Scheduled Tasks is a feature that allows you to schedule tasks based on a huge number or conditions.
First you need to create a folder that the will hold the offline copies on your Windows RT device. I created a folder hierarchy based on what windows normally does. I have a folder called āCSCā on the C drive to store all offline files (CSC stands for Client Side Caching, the internal name for Offline Files). In there I have one folder per remote machine (e.x. āSERVERā), and then folders in there matching the folder hierarchy on the remote machine. So for this example my Folder structure looks like:
Next we need to create a batch file that will run RoboCopy with the correct parameters. I created mine in the SERVER folder with the name of the folder its copying (note you will need one batch file per folder) so I have one called āMusic.batā and another called āPictures.batā. In to the batch each batch file we enter the following:
robocopy ā\\SERVER\Musicā āC:\CSC\SERVER\Musicā /mir /z /copy:DAT /mon:1 /r:10
The first argument is the folder on the server we want to make available offline.
The second is the folder we want to store the offline copy in.
/mir tells RoboCopy to mirror the two folders. If a file or folder is added to one, add it to the other. If a file or folder is removed from one remove it from the other. Changes are also kept.
/z tells RoboCopy to copy in recoverable mode so that if you have network issues it wonāt crash. This does make copying slower though.
/copy:DAT tells RoboCopy to copy Data, Attributes, and Time for each folder/file.
/mon:1 tells RoboCopy to wait for one change in either folder before mirroring (in theory making this number higher could impact battery life less at the cost of being less in sync)
/r:10 tells Robocopy to retry each file 10 times before giving up.
We have one more step to make RoboCopy work. If the remote folders need a different account for access permission you need to have Windows remember the account. This can be done simply by visiting the folders and selecting āRemember Accountā in the dialog that is presented to enter the account.
These batch files will do the heavy lifting of the offline files, but unless you want to manually start each one when you reboot your machine (which wonāt happen often with RT I admit but never the less with happen) we can use Scheduled Tasks to make the batch files start on logon.
First to find the Scheduled Tasks UI go to the start screen and type āscheduled tasksā and switch to settings, it should be the only option there. In the UI select āCreate Taskā¦ā from the Actions panel on the right. For each tab do the following
General: You can set the name and description to what ever you like, leave the rest as defaults.
Triggers: Add on trigger for log on of the current user (may work with all, not tested)
Actions: Add one action for each batch file, starting it.
Conditions: Set as you like. I set it so that it only start if on my home network but will work even on battery power.
Settings: Make sure to uncheck āStop the task if running longer than:ā
Click ok and thatās it. If everything works correctly you can just restart your surface and soon enough have offline files.