Skip to content

Commit 4300f61

Browse files
authored
Merge pull request #23 from rebelinux/dev
v0.6.2 #2
2 parents 9955088 + 2fa9fa8 commit 4300f61

File tree

8 files changed

+161
-101
lines changed

8 files changed

+161
-101
lines changed

Src/Private/Get-AbrADCACRLSetting.ps1

Lines changed: 33 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,19 @@ function Get-AbrADCACRLSetting {
3434
Write-PscriboMessage "Collecting AD CA CRL Validity Period information on $($CA.Name)."
3535
$CRLs = Get-CRLValidityPeriod -CertificationAuthority $CA
3636
foreach ($VP in $CRLs) {
37-
$inObj = [ordered] @{
38-
'CA Name' = $VP.Name
39-
'Base CRL' = $VP.BaseCRL
40-
'Base CRL Overlap' = $VP.BaseCRLOverlap
41-
'Delta CRL' = $VP.DeltaCRL
42-
'Delta CRL Overlap' = $VP.DeltaCRLOverlap
37+
try {
38+
$inObj = [ordered] @{
39+
'CA Name' = $VP.Name
40+
'Base CRL' = $VP.BaseCRL
41+
'Base CRL Overlap' = $VP.BaseCRLOverlap
42+
'Delta CRL' = $VP.DeltaCRL
43+
'Delta CRL Overlap' = $VP.DeltaCRLOverlap
44+
}
45+
$OutObj += [pscustomobject]$inobj
46+
}
47+
catch {
48+
Write-PscriboMessage -IsWarning $_.Exception.Message
4349
}
44-
$OutObj += [pscustomobject]$inobj
4550
}
4651
}
4752
catch {
@@ -67,12 +72,17 @@ function Get-AbrADCACRLSetting {
6772
Write-PscriboMessage "Collecting AD CA CRL Distribution Point information on $($CA.Name)."
6873
$CRLs = Get-CertificateRevocationListFlag -CertificationAuthority $CA
6974
foreach ($Flag in $CRLs) {
70-
$inObj = [ordered] @{
71-
'CA Name' = $Flag.Name
72-
'Server Name' = $Flag.ComputerName.ToString().ToUpper().Split(".")[0]
73-
'CRL Flags' = $Flag.CRLFlags
75+
try {
76+
$inObj = [ordered] @{
77+
'CA Name' = $Flag.Name
78+
'Server Name' = $Flag.ComputerName.ToString().ToUpper().Split(".")[0]
79+
'CRL Flags' = $Flag.CRLFlags
80+
}
81+
$OutObj += [pscustomobject]$inobj
82+
}
83+
catch {
84+
Write-PscriboMessage -IsWarning $_.Exception.Message
7485
}
75-
$OutObj += [pscustomobject]$inobj
7686
}
7787
}
7888
catch {
@@ -160,13 +170,18 @@ function Get-AbrADCACRLSetting {
160170
try {
161171
$CAHealth = Get-EnterprisePKIHealthStatus -CertificateAuthority $CA
162172
foreach ($Health in $CAHealth) {
163-
Write-PscriboMessage "Collecting AIA and CDP Health Status from $($Health.Name)."
164-
$inObj = [ordered] @{
165-
'CA Name' = $Health.Name
166-
'Childs' = ($Health.Childs).Name
167-
'Health' = $Health.Status
173+
try {
174+
Write-PscriboMessage "Collecting AIA and CDP Health Status from $($Health.Name)."
175+
$inObj = [ordered] @{
176+
'CA Name' = $Health.Name
177+
'Childs' = ($Health.Childs).Name
178+
'Health' = $Health.Status
179+
}
180+
$OutObj += [pscustomobject]$inobj
181+
}
182+
catch {
183+
Write-PscriboMessage -IsWarning $_.Exception.Message
168184
}
169-
$OutObj += [pscustomobject]$inobj
170185
}
171186
}
172187
catch {

Src/Private/Get-AbrADCAKeyRecoveryAgent.ps1

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ function Get-AbrADCAKeyRecoveryAgent {
2323
}
2424

2525
process {
26-
try {
27-
$OutObj = @()
28-
foreach ($CA in $CAs) {
26+
$OutObj = @()
27+
foreach ($CA in $CAs) {
28+
try {
2929
$KRA = Get-CAKRACertificate -CertificationAuthority $CA
3030
if ($KRA.Certificate) {
3131
Write-PscriboMessage "Collecting Key Recovery Agent Certificate Certificate information of $($KRA.DisplayName)."
@@ -37,27 +37,27 @@ function Get-AbrADCAKeyRecoveryAgent {
3737
$OutObj += [pscustomobject]$inobj
3838
}
3939
}
40-
if ($OutObj) {
41-
Section -Style Heading4 "Key Recovery Agent Certificate" {
42-
Paragraph "The following section provides the Key Recovery Agent certificate used to encrypt user's certificate private key and store it in CA database. In the case when user cannot access his or her certificate private key it is possible to recover it by Key Recovery Agent if Key Archival procedure was taken against particular certificate."
43-
BlankLine
44-
foreach ($Item in $OutObj) {
45-
$TableParams = @{
46-
Name = "Key Recovery Agent Certificate - $($Item.'CA Name')"
47-
List = $true
48-
ColumnWidths = 40, 60
49-
}
50-
if ($Report.ShowTableCaptions) {
51-
$TableParams['Caption'] = "- $($TableParams.Name)"
52-
}
53-
$Item | Table @TableParams
40+
catch {
41+
Write-PscriboMessage -IsWarning "$($_.Exception.Message) (Key Recovery Agent Certificate Item)"
42+
}
43+
}
44+
if ($OutObj) {
45+
Section -Style Heading4 "Key Recovery Agent Certificate" {
46+
Paragraph "The following section provides the Key Recovery Agent certificate used to encrypt user's certificate private key and store it in CA database. In the case when user cannot access his or her certificate private key it is possible to recover it by Key Recovery Agent if Key Archival procedure was taken against particular certificate."
47+
BlankLine
48+
foreach ($Item in $OutObj) {
49+
$TableParams = @{
50+
Name = "Key Recovery Agent Certificate - $($Item.'CA Name')"
51+
List = $true
52+
ColumnWidths = 40, 60
5453
}
54+
if ($Report.ShowTableCaptions) {
55+
$TableParams['Caption'] = "- $($TableParams.Name)"
56+
}
57+
$Item | Table @TableParams
5558
}
5659
}
5760
}
58-
catch {
59-
Write-PscriboMessage -IsWarning "$($_.Exception.Message) (Key Recovery Agent Certificate)"
60-
}
6161
}
6262

6363
end {}

Src/Private/Get-AbrADCASecurity.ps1

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,17 @@ function Get-AbrADCASecurity {
6161
$ACLs = Get-CertificationAuthorityAcl -CertificationAuthority $CA
6262
Write-PscriboMessage "Collecting Certification Authority Access Control List information of $($CA.Name)."
6363
foreach ($ACL in $ACLs) {
64-
$inObj = [ordered] @{
65-
'DC Name' = $CA.DisplayName
66-
'Owner' = $ACL.Owner
67-
'Group' = $ACL.Group
64+
try {
65+
$inObj = [ordered] @{
66+
'DC Name' = $CA.DisplayName
67+
'Owner' = $ACL.Owner
68+
'Group' = $ACL.Group
69+
}
70+
$OutObj += [pscustomobject]$inobj
71+
}
72+
catch {
73+
Write-PscriboMessage -IsWarning $_.Exception.Message
6874
}
69-
$OutObj += [pscustomobject]$inobj
7075
}
7176
}
7277
catch {

Src/Private/Get-AbrADDNSInfrastructure.ps1

Lines changed: 33 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,20 @@ function Get-AbrADDNSInfrastructure {
8080
$DNSSettings = Invoke-Command -Session $DCPssSession {Get-NetAdapter | Get-DnsClientServerAddress -AddressFamily IPv4}
8181
Remove-PSSession -Session $DCPssSession
8282
foreach ($DNSSetting in $DNSSettings) {
83-
$inObj = [ordered] @{
84-
'DC Name' = $DC.ToString().ToUpper().Split(".")[0]
85-
'Interface' = $DNSSetting.InterfaceAlias
86-
'DNS IP 1' = ConvertTo-EmptyToFiller $DNSSetting.ServerAddresses[0]
87-
'DNS IP 2' = ConvertTo-EmptyToFiller $DNSSetting.ServerAddresses[1]
88-
'DNS IP 3' = ConvertTo-EmptyToFiller $DNSSetting.ServerAddresses[2]
89-
'DNS IP 4' = ConvertTo-EmptyToFiller $DNSSetting.ServerAddresses[3]
83+
try {
84+
$inObj = [ordered] @{
85+
'DC Name' = $DC.ToString().ToUpper().Split(".")[0]
86+
'Interface' = $DNSSetting.InterfaceAlias
87+
'DNS IP 1' = ConvertTo-EmptyToFiller $DNSSetting.ServerAddresses[0]
88+
'DNS IP 2' = ConvertTo-EmptyToFiller $DNSSetting.ServerAddresses[1]
89+
'DNS IP 3' = ConvertTo-EmptyToFiller $DNSSetting.ServerAddresses[2]
90+
'DNS IP 4' = ConvertTo-EmptyToFiller $DNSSetting.ServerAddresses[3]
91+
}
92+
$OutObj += [pscustomobject]$inobj
93+
}
94+
catch {
95+
Write-PscriboMessage -IsWarning $_.Exception.Message
9096
}
91-
$OutObj += [pscustomobject]$inobj
9297
}
9398
}
9499
catch {
@@ -130,13 +135,18 @@ function Get-AbrADDNSInfrastructure {
130135
try {
131136
$DNSSetting = Invoke-Command -Session $Session {Get-DnsServerDirectoryPartition -ComputerName $using:DC}
132137
foreach ($Partition in $DNSSetting) {
133-
$inObj = [ordered] @{
134-
'Name' = $Partition.DirectoryPartitionName
135-
'State' = ConvertTo-EmptyToFiller $Partition.State
136-
'Flags' = $Partition.Flags
137-
'Zone Count' = $Partition.ZoneCount
138+
try {
139+
$inObj = [ordered] @{
140+
'Name' = $Partition.DirectoryPartitionName
141+
'State' = ConvertTo-EmptyToFiller $Partition.State
142+
'Flags' = $Partition.Flags
143+
'Zone Count' = $Partition.ZoneCount
144+
}
145+
$OutObj += [pscustomobject]$inobj
146+
}
147+
catch {
148+
Write-PscriboMessage -IsWarning $_.Exception.Message
138149
}
139-
$OutObj += [pscustomobject]$inobj
140150
}
141151
}
142152
catch {
@@ -308,11 +318,16 @@ function Get-AbrADDNSInfrastructure {
308318
try {
309319
$DNSSetting = Invoke-Command -Session $Session {Get-DnsServerRootHint -ComputerName $using:DC | Select-Object @{Name="Name"; E={$_.NameServer.RecordData.Nameserver}},@{Name="IPAddress"; E={$_.IPAddress.RecordData.IPv6Address.IPAddressToString,$_.IPAddress.RecordData.IPv4Address.IPAddressToString} }}
310320
foreach ($Hints in $DNSSetting) {
311-
$inObj = [ordered] @{
312-
'Name' = $Hints.Name
313-
'IP Address' = (($Hints.IPAddress).Where({ $_ -ne $Null })) -join ", "
321+
try {
322+
$inObj = [ordered] @{
323+
'Name' = $Hints.Name
324+
'IP Address' = (($Hints.IPAddress).Where({ $_ -ne $Null })) -join ", "
325+
}
326+
$OutObj += [pscustomobject]$inobj
327+
}
328+
catch {
329+
Write-PscriboMessage -IsWarning $_.Exception.Message
314330
}
315-
$OutObj += [pscustomobject]$inobj
316331
}
317332
}
318333
catch {

Src/Private/Get-AbrADDomainController.ps1

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -206,21 +206,26 @@ function Get-AbrADDomainController {
206206
$SourceType = Invoke-Command -Session $DCPssSession -ScriptBlock {Get-ItemProperty -Path HKLM:\System\CurrentControlSet\Services\W32Time\Parameters | Select-Object -ExpandProperty 'Type'}
207207
Remove-PSSession -Session $DCPssSession
208208
if ( $NtpServer -and $SourceType ) {
209-
$inObj = [ordered] @{
210-
'Name' = $DC.ToString().ToUpper().Split(".")[0]
211-
'Time Server' = Switch ($NtpServer) {
212-
'time.windows.com,0x8' {"Domain Hierarchy"}
213-
'time.windows.com' {"Domain Hierarchy"}
214-
'0x8' {"Domain Hierarchy"}
215-
default {$NtpServer}
216-
}
217-
'Type' = Switch ($SourceType) {
218-
'NTP' {"MANUAL (NTP)"}
219-
'NT5DS' {"DOMHIER"}
220-
default {$SourceType}
209+
try {
210+
$inObj = [ordered] @{
211+
'Name' = $DC.ToString().ToUpper().Split(".")[0]
212+
'Time Server' = Switch ($NtpServer) {
213+
'time.windows.com,0x8' {"Domain Hierarchy"}
214+
'time.windows.com' {"Domain Hierarchy"}
215+
'0x8' {"Domain Hierarchy"}
216+
default {$NtpServer}
217+
}
218+
'Type' = Switch ($SourceType) {
219+
'NTP' {"MANUAL (NTP)"}
220+
'NT5DS' {"DOMHIER"}
221+
default {$SourceType}
222+
}
221223
}
224+
$OutObj += [pscustomobject]$inobj
225+
}
226+
catch {
227+
Write-PscriboMessage -IsWarning $_.Exception.Message
222228
}
223-
$OutObj += [pscustomobject]$inobj
224229
}
225230
}
226231
catch {
@@ -263,12 +268,17 @@ function Get-AbrADDomainController {
263268
Paragraph "The following section provides a summary of additional software running on $($DC.ToString().ToUpper().Split(".")[0])."
264269
BlankLine
265270
foreach ($APP in $Software) {
266-
$inObj = [ordered] @{
267-
'Name' = $APP.DisplayName
268-
'Publisher' = $APP.Publisher
269-
'Install Date' = $APP.InstallDate
271+
try {
272+
$inObj = [ordered] @{
273+
'Name' = $APP.DisplayName
274+
'Publisher' = $APP.Publisher
275+
'Install Date' = $APP.InstallDate
276+
}
277+
$OutObj = [pscustomobject]$inobj
278+
}
279+
catch {
280+
Write-PscriboMessage -IsWarning $_.Exception.Message
270281
}
271-
$OutObj = [pscustomobject]$inobj
272282
}
273283
$TableParams = @{
274284
Name = "Installed Software - $($DC.ToString().ToUpper().Split(".")[0])"

0 commit comments

Comments
 (0)