title: How do I run New-DfsnRoot remotely
body: <p>I am trying to build a Windows Server 2019 DFS remotely. My client PC is Windows 10.</p>
  
  <p>First I create a folder and a share remotely. All is okay.</p>
  
  <p>Then I do this from my client PC</p>
  
  <pre><code>$cimSession = New-CimSession -ComputerName "dfs.MYDOMAIN"
  New-DfsnRoot -Path "\\MYDOMAIN\DfsnRoot" -TargetPath "\\dfs.MYDOMAIN\DfsnRoot" -Type DomainV2 -EnableSiteCosting $true -CimSession $cimSession
  New-DfsnFolder -Path "\\MYDOMAIN\DfsnRoot\ShareName" -State Online -TargetPath "\\FILESERVER\ShareName" -ReferralPriorityClass globalhigh -CimSession $cimSession
  </code></pre>
  
  <p>But it fails with this</p>
  
  <pre><code>New-DfsnRoot : 110
  At C:\Applications\Powershell\CreateShare.ps1:40 char:5
  +     New-DfsnRoot -Path "\\MYDOMAIN\DfsnRoot" -TargetPath "\\dfs.alo ...
  +     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : NotSpecified: (MSFT_DFSNamespace:ROOT\Microsoft\...FT_DFSNamespace) [New-DfsnRoot], CimException
      + FullyQualifiedErrorId : MI RESULT 110,New-DfsnRoot
      + PSComputerName        : dfs.MYDOMAIN
  
  New-DfsnFolder : 80
  At C:\Applications\Powershell\CreateShare.ps1:41 char:5
  +     New-DfsnFolder -Path "\\MYDOMAIN\DfsnRoot\ShareName" -State On ...
  +     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : NotSpecified: (MSFT_DfsNamespaceFolder:Root\Microsoft\...NamespaceFolder) [New-DfsnFolder], CimException
      + FullyQualifiedErrorId : MI RESULT 80,New-DfsnFolder
      + PSComputerName        : dfs.MYDOMAIN
  </code></pre>
  
  <p>I first thought it was the remote connection but since I can create the share and folder remotely that should be fine.</p>
  
  <p>If I run this command directly on the dfs server it works just fine.</p>
  
  <pre><code>New-DfsnRoot -Path "\\MYDOMAIN\DfsnRoot" -TargetPath "\\dfs.MYDOMAIN\DfsnRoot" -Type DomainV2 -EnableSiteCosting $true
  </code></pre>
  
  <p>And actually I can run this after (remotely) with no issues</p>
  
  <pre><code>New-DfsnFolder -Path "\\MYDOMAIN\DfsnRoot\ShareName" -State Online -TargetPath "\\FILESERVER\ShareName" -ReferralPriorityClass globalhigh -CimSession $cimSession
  </code></pre>
  
  <p>It seems like there is an issue with New-DfsnRoot command and running that remotely</p>