0

I am trying to build a Windows Server 2019 DFS remotely. My client PC is Windows 10.

First I create a folder and a share remotely. All is okay.

Then I do this from my client PC

$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

But it fails with this

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

I first thought it was the remote connection but since I can create the share and folder remotely that should be fine.

If I run this command directly on the dfs server it works just fine.

New-DfsnRoot -Path "\\MYDOMAIN\DfsnRoot" -TargetPath "\\dfs.MYDOMAIN\DfsnRoot" -Type DomainV2 -EnableSiteCosting $true

And actually I can run this after (remotely) with no issues

New-DfsnFolder -Path "\\MYDOMAIN\DfsnRoot\ShareName" -State Online -TargetPath "\\FILESERVER\ShareName" -ReferralPriorityClass globalhigh -CimSession $cimSession

It seems like there is an issue with New-DfsnRoot command and running that remotely

Anders
  • 567
  • 1
  • 7
  • 23

2 Answers2

0

The error in the command indicates 'could not be found', and the output error you're putting shows that the text in the script was

\MYDOMAIN\$DfsnRoot

Note the $, indicating what seems like it should have been a variable but the string wasn't put together properly. Are you sure that the snippet you put in your question matches exactly the script you're having issues with?

0

I figured it out.

When you run the New-DfsnRoot command you should run it local and not remotely. The New-DfsnFolder should still run remotely. Working script looks like this.

$cimSession = New-CimSession -ComputerName "dfs.MYDOMAIN"
New-DfsnRoot -Path "\\MYDOMAIN\DfsnRoot" -TargetPath "\\dfs.MYDOMAIN\DfsnRoot" -Type DomainV2 -EnableSiteCosting $true
New-DfsnFolder -Path "\\MYDOMAIN\DfsnRoot\ShareName" -State Online -TargetPath "\\FILESERVER\ShareName" -ReferralPriorityClass globalhigh -CimSession $cimSession
Anders
  • 567
  • 1
  • 7
  • 23