1+ function Get-AbrADDFSHealth {
2+ <#
3+ . SYNOPSIS
4+ Used by As Built Report to retrieve Microsoft AD Domain DFS Health information.
5+ . DESCRIPTION
6+
7+ . NOTES
8+ Version: 0.7.0
9+ Author: Jonathan Colon
10+ Twitter: @jcolonfzenpr
11+ Github: rebelinux
12+ . EXAMPLE
13+
14+ . LINK
15+
16+ #>
17+ [CmdletBinding ()]
18+ param (
19+ [Parameter (
20+ Position = 0 ,
21+ Mandatory )]
22+ [string ]
23+ $Domain
24+ )
25+
26+ begin {
27+ Write-PscriboMessage " Discovering AD Domain DFS Health information on $Domain ."
28+ }
29+
30+ process {
31+ if ($Domain -and $HealthCheck.Domain.DFS ) {
32+ try {
33+ $DFS = Get-WinADDFSHealth - Domain $Domain
34+ Write-PscriboMessage " Discovered AD Domain DFS Health information from $Domain ."
35+ if ($DFS ) {
36+ Section - Style Heading4 ' Health Check - DFS Health' {
37+ Paragraph " The following section details Distributed File System health status for Domain $ ( $Domain.ToString ().ToUpper()) ."
38+ BlankLine
39+ $OutObj = @ ()
40+ foreach ($DCStatus in $DFS ) {
41+ try {
42+ Write-PscriboMessage " Collecting DFS information from $ ( $Domain ) ."
43+ $inObj = [ordered ] @ {
44+ ' DC Name' = $DCStatus.DomainController
45+ ' Replication State' = $DCStatus.ReplicationState
46+ ' GPO Count' = $DCStatus.GroupPolicyCount
47+ ' Sysvol Count' = $DCStatus.SysvolCount
48+ ' Identical Count' = ConvertTo-TextYN $DCStatus.IdenticalCount
49+ ' Stop Replication On AutoRecovery' = ConvertTo-TextYN $DCStatus.StopReplicationOnAutoRecovery
50+
51+ }
52+ $OutObj += [pscustomobject ]$inobj
53+ }
54+ catch {
55+ Write-PscriboMessage - IsWarning " $ ( $_.Exception.Message ) (DFS Health Item)"
56+ }
57+ }
58+
59+ if ($HealthCheck.Domain.DFS ) {
60+ $OutObj | Where-Object { $_ .' Identical Count' -like ' No' } | Set-Style - Style Warning - Property ' Identical Count'
61+ }
62+
63+ $TableParams = @ {
64+ Name = " Domain Last Backup - $ ( $Domain.ToString ().ToUpper()) "
65+ List = $false
66+ ColumnWidths = 20 , 16 , 16 , 16 , 16 , 16
67+ }
68+
69+ if ($Report.ShowTableCaptions ) {
70+ $TableParams [' Caption' ] = " - $ ( $TableParams.Name ) "
71+ }
72+ $OutObj | Sort-Object - Property ' Naming Context' | Table @TableParams
73+ Paragraph " Health Check:" - Italic - Bold - Underline
74+ Paragraph " Corrective Actions: Ensure an identical GPO/SYSVOL content for the domain controller in all Active Directory domains." - Italic - Bold
75+ }
76+ }
77+ }
78+ catch {
79+ Write-PscriboMessage - IsWarning " $ ( $_.Exception.Message ) (DFS Health Table)"
80+ }
81+ }
82+ }
83+
84+ end {}
85+
86+ }
0 commit comments