-
Notifications
You must be signed in to change notification settings - Fork 3
/
Get-AbrHRZDomains.ps1
116 lines (102 loc) · 5.18 KB
/
Get-AbrHRZDomains.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
function Get-AbrHRZDomains {
<#
.SYNOPSIS
PowerShell script which documents the configuration of VMware Horizon in Word/HTML/XML/Text formats
.DESCRIPTION
Documents the configuration of VMware Horizon in Word/HTML/XML/Text formats using PScribo.
.NOTES
Version: 1.1.0
Author: Chris Hildebrandt, Karl Newick
Twitter: @childebrandt42, @karlnewick
Editor: Jonathan Colon, @jcolonfzenpr
Twitter: @asbuiltreport
Github: AsBuiltReport
Credits: Iain Brighton (@iainbrighton) - PScribo module
.LINK
https://github.com/AsBuiltReport/AsBuiltReport.VMware.Horizon
#>
[CmdletBinding()]
param (
)
begin {
Write-PScriboMessage "InstantCloneDomainAccounts InfoLevel set at $($InfoLevel.Settings.InstantClone.InstantCloneDomainAccounts)."
Write-PscriboMessage "Collecting Instant Clone Domain Accounts information."
}
process {
try {
section -Style Heading2 "Domains" {
if ($InstantCloneDomainAdmins) {
if ($InfoLevel.Settings.InstantClone.InstantCloneDomainAccounts -ge 1) {
section -Style Heading3 "Domain Accounts" {
Paragraph "The following section details the Domain Accounts configuration for $($HVEnvironment.toUpper()) server."
BlankLine
$OutObj = @()
foreach ($InstantCloneDomainAdmin in $InstantCloneDomainAdmins) {
try {
Write-PscriboMessage "Discovered Domain Accounts Information."
$inObj = [ordered] @{
'User Name' = $InstantCloneDomainAdmin.Base.UserName
'Domain Name' = $InstantCloneDomainAdmin.NamesData.DnsName
}
$OutObj += [pscustomobject](ConvertTo-HashToYN $inObj)
}
catch {
Write-PscriboMessage -IsWarning $_.Exception.Message
}
}
$TableParams = @{
Name = "Domain Accounts - $($HVEnvironment.toUpper())"
List = $false
ColumnWidths = 50, 50
}
if ($Report.ShowTableCaptions) {
$TableParams['Caption'] = "- $($TableParams.Name)"
}
$OutObj | Sort-Object -Property 'User Name' | Table @TableParams
}
}
}
if ($Domains) {
if ($InfoLevel.Settings.Servers.vCenterServers.ADDomains -ge 1) {
section -Style Heading3 "Connection Server" {
Paragraph "The following section shows connection servers domains for $($HVEnvironment.toUpper()) environment."
BlankLine
$OutObj = @()
foreach ($Domain in $Domains) {
try {
Write-PscriboMessage "Discovered Domain Information $($Domain.DNSName)."
$inObj = [ordered] @{
'Domain DNS Name' = $Domain.DNSName
'Status' = $Domain.ConnectionServerState[0].Status
'Trust Relationship' = $Domain.ConnectionServerState[0].TrustRelationship
'Connection Status' = $Domain.ConnectionServerState[0].Contactable
}
$OutObj += [pscustomobject](ConvertTo-HashToYN $inObj)
}
catch {
Write-PscriboMessage -IsWarning $_.Exception.Message
}
}
if ($HealthCheck.DataStores.Status) {
$OutObj | Where-Object { $_.'Status' -eq 'ERROR'} | Set-Style -Style Warning
}
$TableParams = @{
Name = "Connection Server- $($HVEnvironment.toUpper())"
List = $false
ColumnWidths = 25, 25, 25, 25
}
if ($Report.ShowTableCaptions) {
$TableParams['Caption'] = "- $($TableParams.Name)"
}
$OutObj | Sort-Object -Property 'Name' | Table @TableParams
}
}
}
}
}
catch {
Write-PscriboMessage -IsWarning $_.Exception.Message
}
}
end {}
}