Powershell:列出所有DFS命名空间下的共享文件夹
大约 1 分钟
脚本功能: 列出所有DFS空间下的共享目标文件夹
前提条件
需要安装DFSN模块到Powershell
1、安装DFSN模块
- Windows 2012 管理可选特色
- 添加功能
- 选择RSAT 文件服务工具
2、脚本内容
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 -ComputerName dfs-serer-name
#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 | Export-Csv -Path D:\temp\dfs_targets.csv -Encoding UTF8 -NoTypeInformation
原创链接
https://britv8.com/powershell-get-list-of-all-folder-targets-in-domain-namespace/