Examples/Sample_xDFSReplicationGroup.ps1
configuration Sample_xDFSReplicationGroup { param ( [Parameter(Mandatory)] [pscredential] $Credential ) Import-DscResource -Module xDFS Node $NodeName { # Install the Prerequisite features first # Requires Windows Server 2012 R2 Full install WindowsFeature RSATDFSMgmtConInstall { Ensure = "Present" Name = "RSAT-DFS-Mgmt-Con" } # Configure the Replication Group xDFSReplicationGroup RGPublic { GroupName = 'Public' Description = 'Public files for use by all departments' Ensure = 'Present' Members = 'FileServer1','FileServer2.contoso.com' Folders = 'Software' PSDSCRunAsCredential = $Credential DependsOn = "[WindowsFeature]RSATDFSMgmtConInstall" } # End of RGPublic Resource xDFSReplicationGroupConnection RGPublicC1 { GroupName = 'Public' Ensure = 'Present' SourceComputerName = 'FileServer1' DestinationComputerName = 'FileServer2' PSDSCRunAsCredential = $Credential } # End of xDFSReplicationGroupConnection Resource xDFSReplicationGroupConnection RGPublicC2 { GroupName = 'Public' Ensure = 'Present' SourceComputerName = 'FileServer2' DestinationComputerName = 'FileServer1.contoso.com' PSDSCRunAsCredential = $Credential } # End of xDFSReplicationGroupConnection Resource xDFSReplicationGroupFolder RGSoftwareFolder { GroupName = 'Public' FolderName = 'Software' Description = 'DFS Share for storing software installers' DirectoryNameToExclude = 'Temp' PSDSCRunAsCredential = $Credential DependsOn = '[xDFSReplicationGroup]RGPublic' } # End of RGPublic Resource xDFSReplicationGroupMembership RGPublicSoftwareFS1 { GroupName = 'Public' FolderName = 'Software' ComputerName = 'FileServer1' ContentPath = 'd:\Public\Software' PrimaryMember = $true PSDSCRunAsCredential = $Credential DependsOn = '[xDFSReplicationGroupFolder]RGSoftwareFolder' } # End of RGPublicSoftwareFS1 Resource xDFSReplicationGroupMembership RGPublicSoftwareFS2 { GroupName = 'Public' FolderName = 'Software' ComputerName = 'FileServer2' ContentPath = 'e:\Data\Public\Software' PSDSCRunAsCredential = $Credential DependsOn = '[xDFSReplicationGroupFolder]RGPublicSoftwareFS1' } # End of RGPublicSoftwareFS2 Resource } # End of Node } # End of Configuration $ComputerName = Read-Host -Prompt 'Computer Name' $ConfigData = @{ AllNodes = @( @{ Nodename = $ComputerName CertificateFile = "C:\publicKeys\targetNode.cer" Thumbprint = "AC23EA3A9E291A75757A556D0B71CBBF8C4F6FD8" } ) } Sample_xDFSReplicationGroup ` -configurationData $ConfigData ` -Credential (Get-Credential -Message "Domain Credentials") Start-DscConfiguration ` -Wait ` -Force ` -Verbose ` -ComputerName $ComputerName ` -Path $PSScriptRoot\Sample_xDFSReplicationGroup ` -Credential (Get-Credential -Message "Local Admin Credentials on Remote Machine") |