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