DFS-N consistency analysis and structure export

When managing the DFS, it is imperative to ensure consistency. The flexibility in the configuration also harbors dangers!

You have to make sure that targets are only integrated via a link so that there are no redundant connections. Redundant connections sooner or later lead to problems.

The following command, run from the Windows command prompt, cmd, returns the status of the current configuration.

DFSDiag / TestDFSIntegrity / DFSRoot:\ad\public / Recurse / Full

The following PowerShell script exports all DFS connections to a CSV file in the C:\temp directory. Please make sure that this directory already exists in the location.

[CmdletBinding()]
param(
    $DFSPath = '\\ad\public\*'
    )

Write-Progress "Getting all DFS folders for $DFSPath (this can take a very long time)" -PercentComplete -1
$DFSTree = Get-DfsnFolder $DFSPath

$i = 1
$DFSTree | ForEach-Object{
    Write-Progress "Getting DFS Folder Targets for $($_.Path)" -PercentComplete (($i / $DFSTree.Count) *100)
    
    $DFSTarget = Get-DfsnFolderTarget $_.Path | Select Path, TargetPath,State
    
    $Result = [ordered]@{
        Path = $DFSTarget.Path
        TargetPath = $DFSTarget.TargetPath
        State = $DFSTarget.State
        "ValidFrom_$Env:ComputerName" = Test-Path $DFSTarget.Path
    }
    
    New-Object PSObject -Property $Result
    $i++
    
    } | Sort Path | Export-Csv "c:\temp\DFS-$(Get-Date -format yyyy-MM-dd).csv" -NoTypeInformation

To call the PowerShell script, open the Windows PowerShell ISE on the domain controller:

Insert the script here (1), adapt the namespace (2) to your environment and run the script (3):

You will then find the result in the said directory under C:\temp as a CSV file, which you can now analyze for redundant connections.

Permanent link to this post: https://help.migraven.com/dfs-n-konsistenz-analyse-und-export-der-struktur/

Leave a Comment

Your email address will not be published.