SyncFiles Utility

I actually wrote this utility a few months ago, but it was very useful for the customer I developed it for so I wanted to share it.   This utility was developed because a customer of mine was looking at going to VDI, but they application they used wrote configuration data into locations outside of the user profile which would be replicated with a tool like VMware Persona Management.   It can be used to sync files both on logon and logoff.  It also logs all activity for troubleshooting.   This utility can be very useful anytime files not located in the user profile need to be synced or even if only specific files in user profile need to be synced.  It will work with any VDI or Published Application solution.


The application was developed in .NET 2013 and is a very simple console application.   The configuration for the utility is within the .NET configuration XML file.  Both the .exe and the config file need to be kept together and can be called from any logon script to run when the user logs into the VDI or Published App session.


  1. Create a shared CIFS folder where the synced data will be stored on logoff and then pulled from on logon.  Make sure the user has permission to create folders and files in this directory.  The application will create a folder based on the username of the user executing the utility.
    Screen Shot 2015-01-06 at 9.35.33 AM
  2. Create a shared CIFS folder (can be the same one you created earlier), for the log files to be placed if you choose to enable logging.  Same as before, the user executing the sync needs to be able to write into this directory to be able to create the log file and update it.
    Screen Shot 2015-01-06 at 9.49.25 AM
  3. The application requires the Microsoft .NET framework 3.0 be present on the systems where it will run.


All configuration is done within the XML configuration file “SyncFiles.exe.config” This file can be modified in any standard text editor, including notepad.

  1. Configure location to sync files to and from.   This should be a standard CIFS file share.  Enter the share UNC in the “Sharepath” configuration section inside the value key.


  2. Configure files to sync.   Many files can be configured for sync, the file paths need to be separated by a pipe “|”.  The full path to the local file that needs to be synced should be specified in the configuration file.
  3. Configure log file path.   Enter the path to the CIFS file share you created earlier where the logon and logoff logging will be captured.  Note:  This is dependent on the EnableLogging value being set to True.  If you don’t want to enable logging you can skip configuring this value.
  4. Configure Logging.  If set to True, logging events will be captured for Logon and Logoff events.  The log file is stored in the following format Username_action. Example:  Chris_Logoff.txt
  5. Set direction of file copy.   This utility can be used for both logon and logoff events.  On a logon event, the specified files will be copied from the network share location to the local computer.  On a logoff event, the specified files will be copied from the local computer to the network share.

    To configure for a Logon set the IsLogon value to True:

    To configure for a Logoff set the IsLogon value to False:

  6. Set ForceCopy value.   If set to true the utility will always overwrite the files on either a logon on logoff event.  If set to False the utility will examine file timestamps to overwrite only newer files.


Using the Utility:

Once you have the utility configured you can execute the file by running SyncFiles.exe to test the results.  You need to keep the SyncFiles.exe and the SyncFiles.exe.config file in the same directory.  You can call the utility using an existing logon script or you can set the file directly as a logon script as shown below.


The files will be copied to the designated user folder with the full file path in the file name on the network share as shown below:

Screen Shot 2015-01-06 at 11.12.42 AM

Please let me know of any suggestions, comments or issues.  I can be reached on Twitter at @chrisdhalstead

You can download the SyncFiles Utility Here:

This entry was posted in Horizon View Utilities and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s