So as a Linux/Unix guy I absolutely cannot stand how poorly offine files or roaming profiles perform under winows. It’s just pathetic especially when you can setup a Samba 3.5 or even 4.0 server in a few minutes and get the same thing working so much better with little effort. So in an effort to circumvent the poor performance but still get documents/favorites/desktop syncronized to a server (mainly for backup purproses) I wrote this batch file that uses unison (an opensource *nix application) compiled for windows to syncronize them. It first attempts to mount a home directory (which we have the server with the username because despite use having a Windows AD domain I have all the important files stored on a linux samba server). It then checks to see if that mount was successful. It then checks for the presense of the directories creating them if needed on the remote server followed by the actual syncronization. With unison you can have the user logged into multiple machines running this script without risk of lossing data. As long as nothing conflits it will merge them without issue. In case of conflict it will throw an error. Also, note that I used distributed filesystem for this script and then deployed with group policy as logon and logoff script.
The script is smart enough to handle both XP and 7 Documents directories.
Unison for Windows and be found Here.
:: ORION CUSD #223 :: End User Syncronization Script :: Uses Unison File Syncronization Tool :: Written by: Austin D. Mount net use H: \\server\%USERNAME% set HOMEDIR=H:\ set UNISONPATH=\\domain.local\Unison\unison.exe IF exist %HOMEDIR% ( If exist "%USERPROFILE%\Documents" ( IF not exist "%HOMEDIR%\Documents" mkdir "%HOMEDIR%\Documents" %UNISONPATH% -fat -batch "%USERPROFILE%\Documents" "%HOMEDIR%\Documents" ) ELSE ( If not exist "%HOMEDIR%\My Documents" mkdir "%HOMEDIR%\My Documents" %UNISONPATH% -fat -batch "%USERPROFILE%\My Documents" "%HOMEDIR%\My Documents" ) IF not exist "%HOMEDIR%\Favorites" mkdir "%HOMEDIR%\Favorites" %UNISONPATH% -fat -batch "%USERPROFILE%\Favorites" "%HOMEDIR%\Favorites" IF not exist "%HOMEDIR%\Desktop" mkdir "%HOMEDIR%\Desktop" %UNISONPATH% -fat -batch "%USERPROFILE%\Desktop" "%HOMEDIR%\Desktop" ) ELSE ( echo "Home Directory Not Mounted" )