DSCResources/DSC_DFSReplicationGroup/en-US/about_DFSReplicationGroup.help.txt

.NAME
    DFSReplicationGroup
 
.DESCRIPTION
    This resource is used to create, edit or remove DFS Replication Groups. If used
    to create a Replication Group it should be combined with the
    DFSReplicationGroupMembership resources.
 
.PARAMETER GroupName
    Key - String
    The name of the DFS Replication Group.
 
.PARAMETER Ensure
    Write - String
    Allowed values: Present, Absent
    Specifies whether the DFS Replication Group should exist.
 
.PARAMETER Description
    Write - String
    A description for the DFS Replication Group.
 
.PARAMETER Members
    Write - StringArray
    A list of computers that are members of this Replication Group. These can be specified using either the ComputerName or FQDN name for each member. These may alternatively be defined separately through the DFSReplicationGroupMember resource - NB do NOT use both methods in the same configuration to avoid config flapping. If an FQDN name is used and the DomainName parameter is set, the FQDN domain name must match.
 
.PARAMETER Folders
    Write - StringArray
    A list of folders that are replicated in this Replication Group.
 
.PARAMETER Topology
    Write - String
    Allowed values: Fullmesh, Manual
    This allows a replication topology to assign to the Replication Group. It defaults to Manual, which will not automatically create a topology. If set to Fullmesh, a full mesh topology between all members will be created.
 
.PARAMETER ContentPaths
    Write - StringArray
    An array of DFS Replication Group Content Paths to use for each of the Folders. This can have one entry for each Folder in the Folders parameter and should be set in th same order. If any entry is not blank then the Content Paths will need to be set manually by using the DFSReplicationGroupMembership resource.
 
.PARAMETER DomainName
    Write - String
    The AD domain the Replication Group should created in.
 
.EXAMPLE 1
 
Create a DFS Replication Group called Public containing two members, FileServer1 and
FileServer2. The Replication Group contains a single folder called Software. A description
will be set on the Software folder and it will be set to exclude the directory Temp from
replication. An automatic fullmesh topology is assigned to the replication group connections.
 
Configuration DFSReplicationGroup_FullMesh_Config
{
    param
    (
        [Parameter()]
        [PSCredential]
        $Credential
    )
 
    Import-DscResource -Module DFSDsc
 
    Node localhost
    {
        <#
            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
        DFSReplicationGroup RGPublic
        {
            GroupName = 'Public'
            Description = 'Public files for use by all departments'
            Ensure = 'Present'
            Members = 'FileServer1','FileServer2'
            Folders = 'Software'
            Topology = 'Fullmesh'
            PSDSCRunAsCredential = $Credential
            DependsOn = '[WindowsFeature]RSATDFSMgmtConInstall'
        } # End of RGPublic Resource
 
        DFSReplicationGroupFolder RGSoftwareFolder
        {
            GroupName = 'Public'
            FolderName = 'Software'
            Description = 'DFS Share for storing software installers'
            DirectoryNameToExclude = 'Temp'
            PSDSCRunAsCredential = $Credential
            DependsOn = '[DFSReplicationGroup]RGPublic'
        } # End of RGPublic Resource
 
        DFSReplicationGroupMembership RGPublicSoftwareFS1
        {
            GroupName = 'Public'
            FolderName = 'Software'
            ComputerName = 'FileServer1'
            ContentPath = 'd:\Public\Software'
            PrimaryMember = $true
            PSDSCRunAsCredential = $Credential
            DependsOn = '[DFSReplicationGroupFolder]RGSoftwareFolder'
        } # End of RGPublicSoftwareFS1 Resource
 
        DFSReplicationGroupMembership RGPublicSoftwareFS2
        {
            GroupName = 'Public'
            FolderName = 'Software'
            ComputerName = 'FileServer2'
            ContentPath = 'e:\Data\Public\Software'
            PSDSCRunAsCredential = $Credential
            DependsOn = '[DFSReplicationGroupFolder]RGSoftwareFolder'
        } # End of RGPublicSoftwareFS2 Resource
    } # End of Node
} # End of Configuration
 
.EXAMPLE 2
 
Create a DFS Replication Group called Public containing two members, FileServer1
and FileServer2. The Replication Group contains two folders called Software and Misc.
An automatic Full Mesh connection topology will be assigned. The Content Paths for each
folder and member will be set to 'd:\public\software' and 'd:\public\misc' respectively.
 
Configuration DFSReplicationGroup_Simple_Config
{
    param
    (
        [Parameter()]
        [PSCredential]
        $Credential
    )
 
    Import-DscResource -Module DFSDsc
 
    Node localhost
    {
        <#
            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
        DFSReplicationGroup RGPublic
        {
            GroupName = 'Public'
            Description = 'Public files for use by all departments'
            Ensure = 'Present'
            Members = 'FileServer1','FileServer2'
            Folders = 'Software','Misc'
            Topology = 'Fullmesh'
            ContentPaths = 'd:\public\software','d:\public\misc'
            PSDSCRunAsCredential = $Credential
            DependsOn = '[WindowsFeature]RSATDFSMgmtConInstall'
        } # End of RGPublic Resource
    } # End of Node
} # End of Configuration
 
.EXAMPLE 3
 
Create a DFS Replication Group called Public containing two members, FileServer1 and
FileServer2. The Replication Group contains a single folder called Software. A description
will be set on the Software folder and it will be set to exclude the directory Temp from
replication. The resource group topology is left set to 'Manual' so that the replication
group connections can be defined.
 
Configuration DFSReplicationGroup_Complete_Config
{
    param
    (
        [Parameter()]
        [PSCredential]
        $Credential
    )
 
    Import-DscResource -Module DFSDsc
 
    Node localhost
    {
        <#
            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
        DFSReplicationGroup RGPublic
        {
            GroupName = 'Public'
            Description = 'Public files for use by all departments'
            Ensure = 'Present'
            Members = 'FileServer1.contoso.com','FileServer2.contoso.com'
            Folders = 'Software'
            PSDSCRunAsCredential = $Credential
            DependsOn = '[WindowsFeature]RSATDFSMgmtConInstall'
        } # End of RGPublic Resource
 
        DFSReplicationGroupConnection RGPublicC1
        {
            GroupName = 'Public'
            Ensure = 'Present'
            SourceComputerName = 'FileServer1.contoso.com'
            DestinationComputerName = 'FileServer2.contoso.com'
            PSDSCRunAsCredential = $Credential
        } # End of DFSReplicationGroupConnection Resource
 
        DFSReplicationGroupConnection RGPublicC2
        {
            GroupName = 'Public'
            Ensure = 'Present'
            SourceComputerName = 'FileServer2.contoso.com'
            DestinationComputerName = 'FileServer1.contoso.com'
            PSDSCRunAsCredential = $Credential
        } # End of DFSReplicationGroupConnection Resource
 
        DFSReplicationGroupFolder RGSoftwareFolder
        {
            GroupName = 'Public'
            FolderName = 'Software'
            Description = 'DFS Share for storing software installers'
            DirectoryNameToExclude = 'Temp'
            PSDSCRunAsCredential = $Credential
            DependsOn = '[DFSReplicationGroup]RGPublic'
        } # End of RGPublic Resource
 
        DFSReplicationGroupMembership RGPublicSoftwareFS1
        {
            GroupName = 'Public'
            FolderName = 'Software'
            ComputerName = 'FileServer1.contoso.com'
            ContentPath = 'd:\Public\Software'
            PrimaryMember = $true
            PSDSCRunAsCredential = $Credential
            DependsOn = '[DFSReplicationGroupFolder]RGSoftwareFolder'
        } # End of RGPublicSoftwareFS1 Resource
 
        DFSReplicationGroupMembership RGPublicSoftwareFS2
        {
            GroupName = 'Public'
            FolderName = 'Software'
            ComputerName = 'FileServer2.contoso.com'
            ContentPath = 'e:\Data\Public\Software'
            PSDSCRunAsCredential = $Credential
            DependsOn = '[DFSReplicationGroupFolder]RGSoftwareFolder'
        } # End of RGPublicSoftwareFS2 Resource
    } # End of Node
} # End of Configuration
 
.EXAMPLE 4
 
Create a Hub and Spoke style DFS Replication Group called WebSite
containing one Hub member and one or more Spoke members. The name of
the Hub computer is passed in the HubComputerName parameter and
defaults to 'Hub'. The Hub member contains a folder called WebSiteFiles
with the path 'd:\inetpub\wwwroot\WebSiteFiles'. This path is
replicated to all members of the SpokeComputerName parameter array
into the 'd:\inetpub\wwwroot\WebSiteFiles' folder. The spoke
computers are passed in the SpokeComputerName parameter and
defaults to 'Spoke1', 'Spoke2' and 'Spoke3'.
 
Configuration DFSReplicationGroup_HubAndSpoke_Config
{
    param
    (
        [Parameter()]
        [PSCredential]
        $Credential,
 
        [Parameter()]
        [System.String]
        $HubComputerName = 'Hub',
 
        [Parameter()]
        [System.String[]]
        $SpokeComputerName = @('Spoke1','Spoke2','Spoke3')
    )
 
    Import-DscResource -Module DFSDsc
 
    Node localhost
    {
        <#
            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
        DFSReplicationGroup RGWebSite
        {
            GroupName = 'WebSite'
            Description = 'Files for web server'
            Ensure = 'Present'
            Members = @() + $HubComputerName + $SpokeComputerName
            Folders = 'WebSiteFiles'
            PSDSCRunAsCredential = $Credential
            DependsOn = '[WindowsFeature]RSATDFSMgmtConInstall'
        } # End of RGWebSite Resource
 
        DFSReplicationGroupFolder RGWebSiteFolder
        {
            GroupName = 'WebSite'
            FolderName = 'WebSiteFiles'
            Description = 'DFS Share for replicating web site files'
            PSDSCRunAsCredential = $Credential
            DependsOn = '[DFSReplicationGroup]RGWebSite'
        } # End of RGWebSiteFolder Resource
 
        DFSReplicationGroupMembership RGWebSiteMembershipHub
        {
            GroupName = 'WebSite'
            FolderName = 'WebSiteFiles'
            ComputerName = $HubComputerName
            ContentPath = 'd:\inetpub\wwwroot\WebSiteFiles'
            PrimaryMember = $true
            PSDSCRunAsCredential = $Credential
            DependsOn = '[DFSReplicationGroupFolder]RGWebSiteFolder'
        } # End of RGWebSiteMembershipHub Resource
 
        # Configure the connection and membership for each Spoke
        foreach ($spoke in $SpokeComputerName)
        {
            DFSReplicationGroupConnection "RGWebSiteConnection$spoke"
            {
                GroupName = 'WebSite'
                Ensure = 'Present'
                SourceComputerName = $HubComputerName
                DestinationComputerName = $spoke
                PSDSCRunAsCredential = $Credential
                DependsOn = '[DFSReplicationGroupFolder]RGWebSiteFolder'
            } # End of RGWebSiteConnection$spoke Resource
 
            DFSReplicationGroupMembership "RGWebSiteMembership$spoke"
            {
                GroupName = 'WebSite'
                FolderName = 'WebSiteFiles'
                ComputerName = $spoke
                ContentPath = 'd:\inetpub\wwwroot\WebSiteFiles'
                PSDSCRunAsCredential = $Credential
                DependsOn = "[DFSReplicationGroupConnection]RGWebSiteConnection$spoke"
            } # End of RGWebSiteMembership$spoke Resource
        }
    } # End of Node
} # End of Configuration
 
.EXAMPLE 5
 
Create a DFS Replication Group called Public containing members defined separately,
FileServer1 and FileServer2. The Replication Group contains a single folder called Software.
A description will be set on the Software folder and it will be set to exclude the directory Temp
from replication. Create a two-way connection between the two nodes.
 
Configuration DFSReplicationGroup_Separate_Simple_Config
{
    param
    (
        [Parameter()]
        [PSCredential]
        $Credential
    )
 
    Import-DscResource -Module DFSDsc
 
    Node localhost
    {
        <#
            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
        DFSReplicationGroup RGPublic
        {
            GroupName = 'Public'
            Description = 'Public files for use by all departments'
            # NB Members parameter must NOT be defined to allow DFSReplicationGroupMember to be used elsewhere - avoid configuration flapping
            Ensure = 'Present'
            Folders = 'Software'
            PSDSCRunAsCredential = $Credential
            DependsOn = '[WindowsFeature]RSATDFSMgmtConInstall'
        } # End of RGPublic Resource
 
        DFSReplicationGroupMember RGPublicMemberFS1
        {
            GroupName = 'Public'
            ComputerName = 'FileServer1'
            Ensure = 'Present'
            PSDSCRunAsCredential = $Credential
            DependsOn = '[DFSReplicationGroup]RGPublic'
        } # End of RGPublicMemberFS1 Resource
 
        DFSReplicationGroupMember RGPublicMemberFS2
        {
            GroupName = 'Public'
            ComputerName = 'FileServer2'
            Ensure = 'Present'
            PSDSCRunAsCredential = $Credential
            DependsOn = '[DFSReplicationGroup]RGPublic'
        } # End of RGPublicMemberFS2 Resource
 
        DFSReplicationGroupFolder RGSoftwareFolder
        {
            GroupName = 'Public'
            FolderName = 'Software'
            Description = 'DFS Share for storing software installers'
            DirectoryNameToExclude = 'Temp'
            PSDSCRunAsCredential = $Credential
            DependsOn = '[DFSReplicationGroup]RGPublic'
        } # End of RGPublic Resource
 
        DFSReplicationGroupMembership RGPublicSoftwareFS1
        {
            GroupName = 'Public'
            FolderName = 'Software'
            ComputerName = 'FileServer1'
            ContentPath = 'd:\Public\Software'
            StagingPathQuotaInMB = 4096
            PrimaryMember = $true
            PSDSCRunAsCredential = $Credential
            DependsOn = '[DFSReplicationGroupMember]RGPublicMemberFS1', '[DFSReplicationGroupFolder]RGSoftwareFolder'
        } # End of RGPublicSoftwareFS1 Resource
 
        DFSReplicationGroupMembership RGPublicSoftwareFS2
        {
            GroupName = 'Public'
            FolderName = 'Software'
            ComputerName = 'FileServer2'
            ContentPath = 'e:\Data\Public\Software'
            StagingPathQuotaInMB = 4096
            PSDSCRunAsCredential = $Credential
            DependsOn = '[DFSReplicationGroupMember]RGPublicMemberFS2', '[DFSReplicationGroupFolder]RGSoftwareFolder'
        } # End of RGPublicSoftwareFS2 Resource
 
        DFSReplicationGroupConnection RGPublicConnectionFS1
        {
            GroupName = 'Public'
            Ensure = 'Present'
            SourceComputerName = 'FileServer1'
            DestinationComputerName = 'FileServer2'
            PSDSCRunAsCredential = $Credential
            DependsOn = '[DFSReplicationGroupFolder]RGSoftwareFolder'
        } # End of RGPublicConnectionFS1 Resource
    } # End of Node
} # End of Configuration