DFS cmdlet behaviour

  • 117 Views
  • Last Post 10 September 2018
neil.ruston posted this 10 September 2018

Hi all,

 

A couple of questions regarding DFS cmdlets.

 

1.     

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?





2.     

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?

 

Thanks,

Neil

 

show

phowell posted this 10 September 2018

Neil,

 

1)     

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.

2)     

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!)

 

$DFSCurrentSettings

= Get-DfsnFolderTarget -Path

$DFSCalcPath

 

$CreationResults

= @()

 

## 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

 

$CreationResults

+= New-DfsnFolderTarget -Path

$DFSCalcPath -TargetPath

$DFSCalcTargetPathPrimary -ReferralPriorityClass

globalhigh

 

## DR Path

 

$CreationResults

+= New-DfsnFolderTarget -Path

$DFSCalcPath -TargetPath

$DFSCalcTargetPathDR -ReferralPriorityClass

globallow

 

## Remove the previous path

 

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

 

Remove-DfsnFolderTarget -Path

$DFSCalcPath -TargetPath

$($DFSCurrentSettings.TargetPath)

-Force

 

Write-Host

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

Write-Host

"Previous Settings:"

$DFSCurrentSettings

| Format-Table -AutoSize

Write-Host

"New Settings:"

$CreationResults

| Format-Table -AutoSize

 

 



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

P.Howell@xxxxxxxxxxxxxxxx



 

show

Close