Adding another server to replication group via xDFS

This topic contains 1 reply, has 1 voice, and was last updated by  Stephen Small 4 months, 1 week ago.

  • Author
    Posts
  • #72289

    Stephen Small
    Participant

    All,

    I have three servers, all domain members, that need to be a part of the same DFS replication group. Two servers are already in the replication group, but I would like to add the third automatically via DSC using the xdfs module. I can add the server via powershell like so:

    Add-DfsrMember -ComputerName server3 -GroupName storage
    Add-DfsrConnection -DestinationComputerName server3 -GroupName storage -SourceComputerName server1 -DomainName domain.com
    Add-DfsrConnection -DestinationComputerName server3 -GroupName storage -SourceComputerName server2 -DomainName domain.com
    Set-DfsrMembership -GroupName "storage" -FolderName "storage" -ComputerName server3 -ContentPath D:\storage
    

    My DSC code is like this but doesn't work:

            xDFSReplicationGroup storage
            {
                GroupName = 'storage'
                Ensure = 'Present'
                Members = 'server1.domain.com','server2.domain.com','server3.domain.com'
                Folders = 'storage'
                PSDSCRunAsCredential = $Credential
                DependsOn = '[WindowsFeature]RSATDFSMgmt'
            }
    
            xDFSReplicationGroupConnection storage1
            {
                GroupName = 'storage'
                Ensure = 'Present'
                SourceComputerName = 'server1.domain.com'
                DestinationComputerName = 'server3.domain.com'
                PSDSCRunAsCredential = $Credential
            }
    
            xDFSReplicationGroupConnection storage2
            {
                GroupName = 'storage'
                Ensure = 'Present'
                SourceComputerName = 'server2.domain.com'
                DestinationComputerName = 'server3.domain.com'
                PSDSCRunAsCredential = $Credential
            }
    
            xDFSReplicationGroupFolder storagefolder
            {
                GroupName = 'storage'
                FolderName = 'storage'
                PSDSCRunAsCredential = $Credential
                DependsOn = '[xDFSReplicationGroup]storage'
            }
    
            xDFSReplicationGroupMembership server3
            {
                GroupName = 'storage'
                FolderName = 'storage'
                ComputerName = 'server3.domain.com'
                ContentPath = 'd:\storage'
                PSDSCRunAsCredential = $Credential
                DependsOn = '[xDFSReplicationGroupFolder]storageFolder'
            }
    

    However, I can not seem to follow how to do this with DSC. any help would be greatly appreciated.

  • #72670

    Stephen Small
    Participant

    Thanks for the help, but the code actually works. I guess AWS didn't want it to work that day. Oh well.

You must be logged in to reply to this topic.