Automating DFSN/R Setup

This topic contains 5 replies, has 3 voices, and was last updated by Profile photo of Kreston Yates Kreston Yates 1 year, 2 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • #28537
    Profile photo of Kreston Yates
    Kreston Yates

    I'm trying to automate the configuration of DFSR and am having a tough time. Setup is pretty straight forward, two DC's holding the namespace and two member servers for the DFSR setup. Ive read this guy quite a few times, but I guess I'm missing something;
    I've pulled the following download and tried the TN script, with the same results;

    #create share for DFS-N
    New-Item -ItemType Directory -Path C:\DFSROOT
    New-SmbShare -Name DFSROOT -Path C:\DFSROOT -FullAccess Administrators -ReadAccess Users
    #Create namespace
    New-DfsnRoot -Path \\$DomainName\DFSROOT -TargetPath \\$DC1\DFSROOT  -Type DomainV2 -EnableSiteCosting $true
    New-DfsnRootTarget -Path \\$DomainName\DFSROOT -TargetPath \\$DC2\DFSROOT
    #Add DFS Folder for the share
    New-DfsnFolder -Path \\$DomainName\DFSROOT\Share -TargetPath \\$Memeber1\Share
    #Add Secondary server to DFS Folder share
    New-DfsnFolderTarget  -Path \\$DomainName\DFSROOT\Share -TargetPath \\$Member2\Share
    #Add Replication Group Name, folder, memebers and connections for Share
    New-DfsReplicationGroup -GroupName $DomainName\dfsroot\Share | New-DfsReplicatedFolder -FolderName Share | Add-DfsrMember -ComputerName "$Member1","$Member2"
    Add-DfsrConnection -GroupName $DomainName\dfsroot\Share -SourceComputerName $Member1 -DestinationComputerName $Member2
    Set-DfsrMembership -GroupName $DomainName\dfsroot\Share -FolderName Share -ComputerName $Member1 -ContentPath D:\Share -StagingPathQuotaInMB 20960 -ConflictAndDeletedQuotaInMB 1024 -PrimaryMember $true -Force
    Set-DfsrMembership -GroupName $DomainName\dfsroot\Share -FolderName Share -ComputerName $Member2 -ContentPath D:\Share -StagingPathQuotaInMB 20960 -ConflictAndDeletedQuotaInMB 1024 -Force
    Get-DfsrMember | Update-DfsrConfigurationFromAD

    so when I run the above code it does NOT error out, but when I double check by going to the DFS GUI, The Namespace folder "share" doesn't show as replicated(even though it shows in the replicated folders below the namespace, and if I try try to use the GUI to perform the same task it says the share is already being replicated). Also, the namespace doesn't list as published. The STRANGE thing is that data is replicated between the two $member servers, so does the GUI not work properly if you use powershell to setup DFSR? I've torn down and rebuilt this setup a number of times with the same results. Any help would be appreciated, this ones been eating my lunch and watching the TN radio video and reading the above articles it seems straightforward, but im clearly missing something.
    Running 2012R2 on all four servers.

    Profile photo of Don Jones
    Don Jones

    It is entirely possible you're looking at a GUI bug. If the share is, in fact, replicating – then mission accomplished. I don't know of a workaround for that, unfortunately.

    Profile photo of Kreston Yates
    Kreston Yates


    Thanks for replying. In looking at it more this AM, if I go into the GUI after running the script, and open replication, and on the right select replicated folders, that's where it states its not published. If I highlight the folder, right click and select "share and publish in namespace" either option will tell me its not possible b/c the folder is already created or you haven't chosen to create any new shares. Now, if I delete the Namespace folder "Share" and go back through the exercise of sharing and publishing via the GUI, it creates the new "share" folder and everything shows as it should in the GUI.

    So either I'm doing something wrong, ie additional, in my script or you are correct that the GUI is not working properly.
    Its unfortunate b/c this process would be quite helpful as far as time saving, but once the environment is in the hands of a customer, they'll more than likely be using the GUI and not PS, so I have to have the GUI right as well.

    Guess I just need someone to test it and tell me I'm not crazy and that there is in fact a bug.

    Profile photo of Don Jones
    Don Jones

    I've put it on Twitter to see if anyone else has run into it. Unfortunately I don't have a way to test it for you, or I would.

    Profile photo of Daniel Krebs
    Daniel Krebs

    You need to use the DfsnPath parameter on New-DfsReplicatedFolder or Set-DfsReplicatedFolder to connect the DFS namespace folder to the replicated folder. It won't happen without using the parameter.

    New-DfsReplicatedFolder -FolderName Share -DfsnPath \\$DomainName\DFSROOT\Share


    Set-DfsReplicatedFolder -GroupName $DomainName\dfsroot\Share -DfsnPath \\$DomainName\DFSROOT\Share

    Profile photo of Kreston Yates
    Kreston Yates

    Don, thanks for the assist.

    Daniel, thanks so much for making my headache go away!!! That was it!! In reading the dfsr cmdlts, I never did, or would have made the connection between this optional setting and how it would affect the GUI. Wew, thanks again!

    Specifies the DFS Namespace (DFSN) folder path of the replicated folder.
    The DFSN folder path has no effect on replication. This property exists only as a descriptive convenience to administrators and DFS Replication service does not validate the value of this property.

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.