How to do it...

  1. Install DFS Namespace, DFS Replication, and the related management tools:
      Install-WindowsFeature -Name FS-DFS-Namespace `
                             -IncludeManagementTools `
                             -ComputerName Srv1
      Install-WindowsFeature -Name FS-DFS-Namespace `
                             -IncludeManagementTools `
                             -ComputerName Srv2
  1. View the DFSN module and the DFSN cmdlets:
      Get-Module -Name DFSN -ListAvailable
      Get-Command -Module DFSN | Measure-Object
  1. Create folders and shares for DFS Root:
      $Sb = {
      New-Item -Path E:\ShareData -ItemType Directory `                                  -Force | Out-Null
      New-SmbShare -Name ShareData -Path E:\ShareData `                                   -FullAccess Everyone
      }
      Invoke-Command -ComputerName Srv1, Srv2 `                     -ScriptBlock $Sb
  1. Create DFS Namespace Root pointing to ShareData:
      New-DfsnRoot -Path \\Reskit.Org\ShareData ...

Get Windows Server 2016 Automation with PowerShell Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.