Configuration File - sjwaterco/FileSyncScript GitHub Wiki
A configuration file is necessary to run both the FileSync.ps1 and the SyncLogReporting.ps1 script. The configuration file is XML-based and may be located on an network share and passed to a script via UNC path.
There is no XSD schema file yet, but this will follow in a future release. An example configuration file follows.
<?xml version="1.0" encoding="iso-8859-1"?>
<syncConfig
syncBatchName="TPS Reports"
retries="10"
retryWaitTime="30"
localLogFolder="C:\TPSReports\SyncLog"
remoteLogFolder="\\fileshare\TPSReportSync\Logs"
computerOU="OU=Laptops,OU=Computers,OU=HQ,DC=domain,DC=local"
reportEmailServer="smtp.domain.local"
reportEmailFrom="[email protected]"
reportEmailTo="[email protected]"
reportEmailSubject="TPS Reports Sync Status"
>
<fileSync
jobName="CategoryA"
displayName="TPS Category A"
remoteRoot="\\domain.local\TPS\Category A"
localRoot="C:\TPSReports\Category A"
includeEmptyFolders="false"
>
<exclude>new</exclude>
<exclude>reviewing</exclude>
</fileSync>
<fileSync
jobName="CategoryB"
displayName="TPS Category B"
remoteRoot="\\domain.local\TPS\Category B"
localRoot="C:\TPSReports\Category B"
includeEmptyFolders="false"
/>
<fileSync
jobName="LegalHold"
displayName="TPS Legal Holds"
remoteRoot="\\domain.local\TPS\Legal Holds"
localRoot="C:\TPSReports\Legal Holds"
/>
</syncConfig>
-
<syncConfig>
- Contains one or more <fileSync> elements.
- Attributes:
- syncBatchName - Name of this sync batch; used for displaying to users and in reporting
- retries - Number of times robocopy should try to copy a file if it encounters an error
- retryWaitTime - Number of seconds to wait between retries
- localLogFolder - Where FileSync.ps1 should save local sync logs from robocopy; recommended to be a subfolder under your localRoot in <fileSync> definitions
- remoteLogFolder - Where FileSync.ps1 should save summary logs for use by the SyncLogReporting.ps1 reporting script
- computerOU - Used by SyncLogReporting.ps1 to fetch a list of computers that should be running the sync script
- reportEmailServer - SMTP server SyncLogReporting.ps1 should use to send e-mail from
- reportEmailFrom - E-mail address that SyncLogReporting.ps1 should use to originate e-mails
- reportEmailTo - E-mail address that should receive sync log reports; used by SyncLogReporting.ps1
- reportEmailSubject - E-mail subject for report e-mails; used by SyncLogReporting.ps1
-
<fileSync>
- Job definitions for a batch. Can contain <exclude> elements for excluding certain files or folders from robocopy
- Attributes:
- jobName - Identifier for a given job; should not have any spaces
- displayName - Name of this job shown to end users and in reports
- remoteRoot - UNC path to synchronize files from
- localRoot - Local path to synchronize files to
- includeEmptyFolders (optional; default true) - If set to false, robocopy will exclude empty folders from the sync job