Synchronize a folder (with subfolder/files) in one direction - optional over a PSSession.
Synchronize a folder (with subfolder/files) in one direction - optional over a PSSession. The follwoing options are available:
- Synchronize two folders on your lokal system
- Synchronize a folder from a remote PC over a PSSession with your local system
- Synchronize a folder to a remote PC over a PSSession with your local system
The advantage of the last 2 points is, that you can synchronize a folder with a remote PC which is not necessarily a member of an Active Directory domain and without connecting a network share . Only PowerShell-Remoting must be enabled and if you are not in the same subnet, you have to add on both sides the other client as TrustedHost (WinRM).
- PowerShell 5.0
.\SyncFolder.ps1 [-Source] <String> [-Destination] <String> [<CommonParameters>]
.\SyncFolder.ps1 [-Source] <String> [-Destination] <String> [-ToSession] [-ComputerName] <String> [[-Credential] <PSCredential>] [<CommonParameters>]
.\SyncFolder.ps1 [-Source] <String> [-Destination] <String> [-FromSession] [-ComputerName] <String> [[-Credential] <PSCredential>] [<CommonParameters>]
PS> .\SyncFolder.ps1 -Source E:\Temp\DemoSource\ -Destination E:\Temp\DemoDestination\ -Verbose
PS> $Cred = Get-Credential $null
PS> .\SyncFolder.ps1 -Source E:\Temp\DemoSource\ -Destination C:\DemoDestination\ -ToSession -ComputerName TEST-DEVICE-01 -Credential $Cred -Verbose