Powershell – Get List Of All Folder Targets In Domain Namespace

This script walks the Domain Namespace (DFSN) and lists all the Folder Targets.

The reason for this script is for me to be able to see what server publishes what folder targets in the domain

#Requires -modules DFSN
#Gets a list of all the folder targets in the Domain Namespace

#Example use
#$results Get-DfsnAllFolderTargets
#$results |select namespacepath,TargetPath,ReferralPriorityRank,ReferralPriorityClass,state   |ogv


function Get-DfsnAllFolderTargets ()
{
    #Get a list of all Namespaces in the Domain
    Write-Progress -Activity "1/3 - Getting List of Domain NameSpaces"
    $RootList = Get-DfsnRoot

    #Get a list of all FolderPaths in the Namespaces
    Write-Progress -Activity "2/3 - Getting List of Domain Folder Paths"
    $FolderPaths = foreach ($item in $RootList)
    {
        Get-DfsnFolder -Path "$($item.path)\*"
    }

    #Get a list of all Folder Targets in the Folder Paths, in the Namespaces"
    Write-Progress -Activity "2/3 - Getting List of Folder Targets"
    $FolderTargets = foreach ($item in $FolderPaths)
    {
        Get-DfsnFolderTarget -Path $item.Path    
    }
    return $FolderTargets
}
Get-DfsnAllFolderTargets

 

2 thoughts on “Powershell – Get List Of All Folder Targets In Domain Namespace

    • Hi,

      Get-DfsnAllFolderTargets |Export-CSV -path c:\DFSNlist.csv -NoTypeInformation

      will export the information to a CSV file

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.