diff --git a/AsBuiltReport.Microsoft.AD.json b/AsBuiltReport.Microsoft.AD.json index 095ff65..469a0e5 100644 --- a/AsBuiltReport.Microsoft.AD.json +++ b/AsBuiltReport.Microsoft.AD.json @@ -43,7 +43,7 @@ "BP": true }, "CA": { - "Status": true + "Status": true, "Statistics": true } } diff --git a/AsBuiltReport.Microsoft.AD.psd1 b/AsBuiltReport.Microsoft.AD.psd1 index 76189d3..943efdf 100644 --- a/AsBuiltReport.Microsoft.AD.psd1 +++ b/AsBuiltReport.Microsoft.AD.psd1 @@ -12,7 +12,7 @@ RootModule = 'AsBuiltReport.Microsoft.AD.psm1' # Version number of this module. -ModuleVersion = '0.6.0' +ModuleVersion = '0.6.1' # Supported PSEditions # CompatiblePSEditions = @() diff --git a/CHANGELOG.md b/CHANGELOG.md index 77c9dc5..bd00676 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # :arrows_counterclockwise: Microsoft AD As Built Report Changelog +## [0.6.1] - 2021-12-07 + +### Added + +- Added Sample HTML Report Link to README file. +- Added DHCP/DNS Powershell module installation instructions. Closes #18 + +### Fixed + +- Improved the code to better detect whether a DHCP/CA infrastructure is in place. Closes #17 +- Fix missing comma in JSON File. Closes #16 + ## [0.6.0] - 2021-12-02 ### Added diff --git a/README.md b/README.md index bdbe60c..3158ed9 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,12 @@ Microsoft AD As Built Report is a PowerShell module which works in conjunction w Please refer to the AsBuiltReport [website](https://www.asbuiltreport.com) for more detailed information about this project. +# :books: Sample Reports + +## Sample Report - Custom Style 1 + +Sample Microsoft AD As Built report HTML file: [Sample Microsoft AD As-Built Report.html](https://technomyth.zenprsolutions.net/wp-content/uploads/2021/12/Microsoft-AD-As-Built-Report.html) + # :beginner: Getting Started Below are the instructions on how to install, configure and generate a Microsoft AD As Built report. @@ -60,6 +66,8 @@ PowerShell 5.1 or PowerShell 7, and the following PowerShell modules are require - [ActiveDirectory Module](https://docs.microsoft.com/en-us/powershell/module/activedirectory/?view=windowsserver2019-ps) - [PSPKI Module](https://www.powershellgallery.com/packages/PSPKI/3.7.2) - [GroupPolicy Module](https://docs.microsoft.com/en-us/powershell/module/grouppolicy/?view=windowsserver2019-ps) +- [DhcpServer Module](https://docs.microsoft.com/en-us/powershell/module/dhcpserver/?view=windowsserver2019-ps) +- [DnsServer Module](https://docs.microsoft.com/en-us/powershell/module/dnsserver/?view=windowsserver2019-ps) ### Linux & macOS @@ -79,6 +87,8 @@ Due to a limitation of the WinRM component, a domain-joined machine is needed, a ```powershell Install-Module AsBuiltReport.Microsoft.AD Install-WindowsFeature RSAT-AD-PowerShell +Install-WindowsFeature RSAT-DNS-Server +Install-WindowsFeature RSAT-DHCP Install-WindowsFeature GPMC ``` @@ -88,6 +98,8 @@ Install-WindowsFeature GPMC Install-Module AsBuiltReport.Microsoft.AD Add-WindowsCapability -online -Name 'Rsat.ActiveDirectory.DS-LDS.Tools~~~~0.0.1.0' Add-WindowsCapability -online -Name 'Rsat.GroupPolicy.Management.Tools~~~~0.0.1.0' +Add-WindowsCapability –online –Name 'Rsat.Dns.Tools~~~~0.0.1.0' +Add-WindowsCapability -Online -Name 'Rsat.DHCP.Tools~~~~0.0.1.0' ``` ### GitHub diff --git a/Src/Private/Get-AbrADDHCPInfrastructure.ps1 b/Src/Private/Get-AbrADDHCPInfrastructure.ps1 index c9d946d..fab966b 100644 --- a/Src/Private/Get-AbrADDHCPInfrastructure.ps1 +++ b/Src/Private/Get-AbrADDHCPInfrastructure.ps1 @@ -5,7 +5,7 @@ function Get-AbrADDHCPInfrastructure { .DESCRIPTION .NOTES - Version: 0.5.0 + Version: 0.6.1 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -73,7 +73,7 @@ function Get-AbrADDHCPInfrastructure { $TableParams['Caption'] = "- $($TableParams.Name)" } $OutObj | Table @TableParams - + Section -Style Heading6 'Service Database' { Paragraph "The following section provides a summary of the DHCP servers service database information on $($Domain.ToString().ToUpper())." BlankLine diff --git a/Src/Private/Get-AbrADDNSInfrastructure.ps1 b/Src/Private/Get-AbrADDNSInfrastructure.ps1 index 4dd6736..289be88 100644 --- a/Src/Private/Get-AbrADDNSInfrastructure.ps1 +++ b/Src/Private/Get-AbrADDNSInfrastructure.ps1 @@ -5,7 +5,7 @@ function Get-AbrADDNSInfrastructure { .DESCRIPTION .NOTES - Version: 0.5.0 + Version: 0.6.1 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -163,7 +163,7 @@ function Get-AbrADDNSInfrastructure { } } } - + if ($InfoLevel.DNS -ge 2) { Section -Style Heading6 "Response Rate Limiting (RRL)" { Paragraph "The following section provides a summary of the DNS Response Rate Limiting configuration." diff --git a/Src/Public/Invoke-AsBuiltReport.Microsoft.AD.ps1 b/Src/Public/Invoke-AsBuiltReport.Microsoft.AD.ps1 index c0705c6..bb5d149 100644 --- a/Src/Public/Invoke-AsBuiltReport.Microsoft.AD.ps1 +++ b/Src/Public/Invoke-AsBuiltReport.Microsoft.AD.ps1 @@ -5,7 +5,7 @@ function Invoke-AsBuiltReport.Microsoft.AD { .DESCRIPTION Documents the configuration of Microsoft AD in Word/HTML/Text formats using PScribo. .NOTES - Version: 0.5.0 + Version: 0.6.1 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux @@ -203,7 +203,7 @@ function Invoke-AsBuiltReport.Microsoft.AD { #---------------------------------------------------------------------------------------------# # DHCP Section # #---------------------------------------------------------------------------------------------# - if ($InfoLevel.DHCP -ge 1) { + if ($InfoLevel.DHCP -ge 1 -and (Invoke-Command -Session $TempPssSession {Get-DhcpServerInDC})) { Section -Style Heading3 "Dynamic Host Configuration Protocol Summary" { if ($Options.ShowDefinitionInfo) { Paragraph "The Dynamic Host Configuration Protocol (DHCP) is a network management protocol used on Internet Protocol (IP) networks for automatically assigning IP addresses and other communication parameters to devices connected to the network using a client/server architecture." @@ -214,95 +214,100 @@ function Invoke-AsBuiltReport.Microsoft.AD { BlankLine } foreach ($Domain in ( Invoke-Command -Session $TempPssSession {Get-ADForest | Select-Object -ExpandProperty Domains | Sort-Object -Descending})) { - Section -Style Heading4 "$($Domain.ToString().ToUpper()) Domain DHCP Configuration" { - Paragraph "The following section provides a summary of the Dynamic Host Configuration Protocol." - BlankLine - Get-AbrADDHCPInfrastructure -Domain $Domain -Session $TempPssSession - Section -Style Heading5 "IPv4 Scope Summary" { - Paragraph "The following section provides a IPv4 configuration summary of the Dynamic Host Configuration Protocol." + try { + Section -Style Heading4 "$($Domain.ToString().ToUpper()) Domain DHCP Configuration" { + Paragraph "The following section provides a summary of the Dynamic Host Configuration Protocol." BlankLine - try { - Get-AbrADDHCPv4Statistic -Domain $Domain -Session $TempPssSession - } - catch { - Write-PScriboMessage -IsWarning "Error: Retreiving DHCP Server IPv4 Statistics from $($Domain.ToString().ToUpper())." - Write-PScriboMessage -IsWarning "$($_.Exception.Message) (IPv4 DHCP Server Statistics)" - } - $DomainDHCPs = Invoke-Command -Session $TempPssSession { Get-DhcpServerInDC | Where-Object {$_.DnsName.split(".", 2)[1] -eq $using:Domain} | Select-Object -ExpandProperty DnsName} - foreach ($DHCPServer in $DomainDHCPs){ + Get-AbrADDHCPInfrastructure -Domain $Domain -Session $TempPssSession + Section -Style Heading5 "IPv4 Scope Summary" { + Paragraph "The following section provides a IPv4 configuration summary of the Dynamic Host Configuration Protocol." + BlankLine try { - Get-AbrADDHCPv4Scope -Domain $Domain -Server $DHCPServer -Session $TempPssSession + Get-AbrADDHCPv4Statistic -Domain $Domain -Session $TempPssSession } catch { - Write-PScriboMessage -IsWarning "$($_.Exception.Message) (IPv4 DHCP Server Scope information)" + Write-PScriboMessage -IsWarning "Error: Retreiving DHCP Server IPv4 Statistics from $($Domain.ToString().ToUpper())." + Write-PScriboMessage -IsWarning "$($_.Exception.Message) (IPv4 DHCP Server Statistics)" } - if ($InfoLevel.DHCP -ge 2) { + $DomainDHCPs = Invoke-Command -Session $TempPssSession { Get-DhcpServerInDC | Where-Object {$_.DnsName.split(".", 2)[1] -eq $using:Domain} | Select-Object -ExpandProperty DnsName} + foreach ($DHCPServer in $DomainDHCPs){ try { - Section -Style Heading6 "$($DHCPServer.ToUpper().split(".", 2)[0]) IPv4 Scope Server Options" { - Paragraph "The following section provides a summary of the DHCP servers IPv4 Scope Server Options information." - BlankLine - Get-AbrADDHCPv4ScopeServerSetting -Domain $Domain -Server $DHCPServer -Session $TempPssSession - $DHCPScopes = Invoke-Command -Session $TempPssSession { Get-DhcpServerv4Scope -ComputerName $using:DHCPServer | Select-Object -ExpandProperty ScopeId} - foreach ($Scope in $DHCPScopes) { - try { - Get-AbrADDHCPv4PerScopeSetting -Domain $Domain -Server $DHCPServer -Session $TempPssSession -Scope $Scope - } - catch { - Write-PScriboMessage -IsWarning "Error: Retreiving DHCP Server IPv4 Scope configuration from $($DHCPServerr.split(".", 2)[0])." - Write-PScriboMessage -IsWarning "$($_.Exception.Message) (IPv4 DHCP Server Scope configuration)" + Get-AbrADDHCPv4Scope -Domain $Domain -Server $DHCPServer -Session $TempPssSession + } + catch { + Write-PScriboMessage -IsWarning "$($_.Exception.Message) (IPv4 DHCP Server Scope information)" + } + if ($InfoLevel.DHCP -ge 2) { + try { + Section -Style Heading6 "$($DHCPServer.ToUpper().split(".", 2)[0]) IPv4 Scope Server Options" { + Paragraph "The following section provides a summary of the DHCP servers IPv4 Scope Server Options information." + BlankLine + Get-AbrADDHCPv4ScopeServerSetting -Domain $Domain -Server $DHCPServer -Session $TempPssSession + $DHCPScopes = Invoke-Command -Session $TempPssSession { Get-DhcpServerv4Scope -ComputerName $using:DHCPServer | Select-Object -ExpandProperty ScopeId} + foreach ($Scope in $DHCPScopes) { + try { + Get-AbrADDHCPv4PerScopeSetting -Domain $Domain -Server $DHCPServer -Session $TempPssSession -Scope $Scope + } + catch { + Write-PScriboMessage -IsWarning "Error: Retreiving DHCP Server IPv4 Scope configuration from $($DHCPServerr.split(".", 2)[0])." + Write-PScriboMessage -IsWarning "$($_.Exception.Message) (IPv4 DHCP Server Scope configuration)" + } } } } - } - catch { - Write-PScriboMessage -IsWarning "$($_.Exception.Message) (IPv4 DHCP Scope Server Options)" + catch { + Write-PScriboMessage -IsWarning "$($_.Exception.Message) (IPv4 DHCP Scope Server Options)" + } } } } - } - Section -Style Heading5 "IPv6 Scope Configuration" { - Paragraph "The following section provides a IPv6 configuration summary of the Dynamic Host Configuration Protocol." - BlankLine - try { - Get-AbrADDHCPv6Statistic -Domain $Domain -Session $TempPssSession - } - catch { - Write-PScriboMessage -IsWarning "Error: Retreiving DHCP Server IPv6 Statistics from $($Domain.ToString().ToUpper())." - Write-PScriboMessage -IsDebug "$($_.Exception.Message) (IPv6 DHCP Server IPv6 Statistics)" - } - $DomainDHCPs = Invoke-Command -Session $TempPssSession { Get-DhcpServerInDC | Where-Object {$_.DnsName.split(".", 2)[1] -eq $using:Domain} | Select-Object -ExpandProperty DnsName} - foreach ($DHCPServer in $DomainDHCPs){ + Section -Style Heading5 "IPv6 Scope Configuration" { + Paragraph "The following section provides a IPv6 configuration summary of the Dynamic Host Configuration Protocol." + BlankLine try { - Get-AbrADDHCPv6Scope -Domain $Domain -Server $DHCPServer -Session $TempPssSession + Get-AbrADDHCPv6Statistic -Domain $Domain -Session $TempPssSession } catch { - Write-PscriboMessage -IsWarning "$($_.Exception.Message) (IPv6 DHCP Scope Information)" + Write-PScriboMessage -IsWarning "Error: Retreiving DHCP Server IPv6 Statistics from $($Domain.ToString().ToUpper())." + Write-PScriboMessage -IsDebug "$($_.Exception.Message) (IPv6 DHCP Server IPv6 Statistics)" } - if ($InfoLevel.DHCP -ge 2) { + $DomainDHCPs = Invoke-Command -Session $TempPssSession { Get-DhcpServerInDC | Where-Object {$_.DnsName.split(".", 2)[1] -eq $using:Domain} | Select-Object -ExpandProperty DnsName} + foreach ($DHCPServer in $DomainDHCPs){ try { - Section -Style Heading6 "$($DHCPServer.ToUpper().split(".", 2)[0]) IPv6 Scope Server Options" { - Paragraph "The following section provides a summary of the DHCP servers IPv6 Scope Server Options information." - BlankLine - Get-AbrADDHCPv6ScopeServerSetting -Domain $Domain -Server $DHCPServer -Session $TempPssSession - $DHCPScopes = Invoke-Command -Session $TempPssSession { Get-DhcpServerv6Scope -ComputerName $using:DHCPServer | Select-Object -ExpandProperty Prefix} - foreach ($Scope in $DHCPScopes) { - try { - Get-AbrADDHCPv6PerScopeSetting -Domain $Domain -Server $DHCPServer -Session $TempPssSession -Scope $Scope - } - catch { - Write-PScriboMessage -IsWarning "Error: Retreiving DHCP Server IPv6 Scope configuration from $($DHCPServerr.split(".", 2)[0])." - Write-PScriboMessage -IsWarning "$($_.Exception.Message) (IPv6 Per DHCP Scope configuration)" + Get-AbrADDHCPv6Scope -Domain $Domain -Server $DHCPServer -Session $TempPssSession + } + catch { + Write-PscriboMessage -IsWarning "$($_.Exception.Message) (IPv6 DHCP Scope Information)" + } + if ($InfoLevel.DHCP -ge 2) { + try { + Section -Style Heading6 "$($DHCPServer.ToUpper().split(".", 2)[0]) IPv6 Scope Server Options" { + Paragraph "The following section provides a summary of the DHCP servers IPv6 Scope Server Options information." + BlankLine + Get-AbrADDHCPv6ScopeServerSetting -Domain $Domain -Server $DHCPServer -Session $TempPssSession + $DHCPScopes = Invoke-Command -Session $TempPssSession { Get-DhcpServerv6Scope -ComputerName $using:DHCPServer | Select-Object -ExpandProperty Prefix} + foreach ($Scope in $DHCPScopes) { + try { + Get-AbrADDHCPv6PerScopeSetting -Domain $Domain -Server $DHCPServer -Session $TempPssSession -Scope $Scope + } + catch { + Write-PScriboMessage -IsWarning "Error: Retreiving DHCP Server IPv6 Scope configuration from $($DHCPServerr.split(".", 2)[0])." + Write-PScriboMessage -IsWarning "$($_.Exception.Message) (IPv6 Per DHCP Scope configuration)" + } } } } - } - catch { - Write-PScriboMessage -IsWarning "$($_.Exception.Message) (IPv6 DHCP Scope Server Options)" + catch { + Write-PScriboMessage -IsWarning "$($_.Exception.Message) (IPv6 DHCP Scope Server Options)" + } } } } } } + catch { + Write-PScriboMessage -IsWarning "$($_.Exception.Message) ($($Domain.ToString().ToUpper()) Domain DHCP Configuration)" + } } } } @@ -310,7 +315,7 @@ function Invoke-AsBuiltReport.Microsoft.AD { # Certificate Authority Section # #---------------------------------------------------------------------------------------------# - if ($InfoLevel.CA -ge 1) { + if ($InfoLevel.CA -ge 1 -and (Get-CertificationAuthority -Enterprise)) { try { Section -Style Heading3 "Certificate Authority Summary" { if ($Options.ShowDefinitionInfo) {