DFS cmdlet behaviour

  • Last Post 3 weeks ago
neil.ruston posted this 3 weeks ago

Hi all,


A couple of questions regarding DFS cmdlets.



Is it possible to specify which domain controller the DFS commands are sent to?

For example, the following commands Set-DFSNFolderTarget, New-DFSNFolderTarget and New-DFSNFolder do not accept a parameter which specifies which DC is used. Does this mean the cmdlets always target the PDC for the domain?


Is it possible to amend a folder target or must the folder be deleted and re-created [with new target]?

When using cmdlet Set-DFSNFolderTarget, it does not appear possible to amend a folder target. Instead, it would appear that a folder must first be deleted and then re-created, with the new target.

Is anyone able to confirm this is correct?






phowell posted this 3 weeks ago




Not that I’ve found and I typically have to build in a delay for AD operations to allow time for replication of changes to happen.  It would be nice to not have to do this.  There’s probably some trickery

involving AD sites and a dedicated DC (single DC in the site) just for programmatics that you could do, but not sure that it’s a recommended solution.


Yes, you can add new targets to the DFSN folder object then remove the old one.  Otherwise you would need to remove the DFSN folder object then add a new one.  I prefer to add then subtract the new

and old targets (respectively) than remove and add the folder itself.


It looks like this:


($DFSCalcPath is calculated by various settings file and parameters of the script, so adjust as needed)

(Also note the ReferralPriorityClass values may not be applicable to your environment, please adjust as needed!)



= Get-DfsnFolderTarget -Path




= @()


## Add the new settings one at a time

## Notable values:

##  Path - DFS Path

##  TargetPath - Server SMB Path

##  ReferralPriorityClass - Valid values are globalhigh and globallow to priority the Primary vs DR path, respectively


## Primary Path



+= New-DfsnFolderTarget -Path

$DFSCalcPath -TargetPath

$DFSCalcTargetPathPrimary -ReferralPriorityClass



## DR Path



+= New-DfsnFolderTarget -Path

$DFSCalcPath -TargetPath

$DFSCalcTargetPathDR -ReferralPriorityClass



## Remove the previous path


#Remove-DfsnFolderTarget -Path $DFSCalcPath -TargetPath $($DFSCurrentSettings.TargetPath) -Confirm:$false


Remove-DfsnFolderTarget -Path

$DFSCalcPath -TargetPath





"nFinished migration of DFS paths to<br /><br /> new system.&nbsp; Enjoy.n"


"Previous Settings:"


| Format-Table -AutoSize


"New Settings:"


| Format-Table -AutoSize



Philip Howell | System Administrator IV | Information Technology | Texas Christian University | O - 817.257.6844 |