Microsoft Windows As Built Report is a PowerShell module which works in conjunction with AsBuiltReport.Core.
AsBuiltReport is an open-sourced community project which utilizes PowerShell to produce as-built documentation in multiple document formats for multiple vendors and technologies.
Please refer to the AsBuiltReport website for more detailed information about this project.
Sample Microsoft Windows As Built report HTML file: Sample Microsoft Windows As-Built Report.html
Below are the instructions on how to install, configure and generate a Microsoft Windows As Built report.
The Microsoft Windows As Built Report supports the following Windows Server versions;
- 2016, 2019 & 2022
This report is compatible with the following PowerShell versions;
Windows PowerShell 5.1 | PowerShell 7 |
---|---|
✅ | ❌ |
PowerShell 5.1 and the following PowerShell modules are required for generating a Microsoft Windows As Built report.
- AsBuiltReport.Microsoft.Windows Module
- IISAdministration Module
- SmbShare Module
- Hyper-V Module
- DhcpServer Module
- DnsServer Module
- FailoverClusters Module
- DBATools Module
This report does not support Linux or Mac due to the fact that the Windows modules are dependent on the .NET Framework. Until Microsoft migrates these modules to native PowerShell Core, only PowerShell >= 5.1.x will be supported on Windows.
A Microsoft Windows As Built Report can be generated with Administrator level privileges. Since this report relies extensively on the WinRM component, you should make sure that it is enabled and configured
The installation of the modules will depend on the roles that are being served on the server to be documented.
Install-Module AsBuiltReport.Microsoft.Windows
# DNS/DHCP Server powershell modules
Install-WindowsFeature -Name RSAT-DNS-Server
Install-WindowsFeature -Name RSAT-DHCP
# Hyper-V Server powershell modules
Install-WindowsFeature -Name Hyper-V-PowerShell
# IIS Server powershell modules
Install-WindowsFeature -Name web-mgmt-console
Install-WindowsFeature -Name Web-Scripting-Tools
# FailOver Cluster powershell modules
Install-WindowsFeature -Name RSAT-Clustering-PowerShell
# DBATools for SQL
Install-Module dbatools
Install-Module AsBuiltReport.Microsoft.Windows
# DNS/DHCP Server powershell Modules
Add-WindowsCapability –online –Name 'Rsat.Dns.Tools~~~~0.0.1.0'
Add-WindowsCapability -Online -Name 'Rsat.DHCP.Tools~~~~0.0.1.0'
#FailOver Cluster powershell modules
Add-WindowsCapability -Online -Name 'Rsat.FailoverCluster.Management.Tools~~~~0.0.1.0'
# Hyper-V Server powershell modules
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-Management-PowerShell
#IIS Server powershell modules
Enable-WindowsOptionalFeature -Online -FeatureName IIS-WebServerRole
Enable-WindowsOptionalFeature -Online -FeatureName IIS-WebServerManagementTools
Enable-WindowsOptionalFeature -Online -FeatureName IIS-ManagementScriptingTools
# DBATools for SQL
Install-Module dbatools
If you are unable to use the PowerShell Gallery, you can still install the module manually. Ensure you repeat the following steps for the system requirements also.
-
Download the code package / latest release zip from GitHub
-
Extract the zip file
-
Copy the folder
AsBuiltReport.Microsoft.Windows
to a path that is set in$env:PSModulePath
. -
Open a PowerShell terminal window and unblock the downloaded files with
$path = (Get-Module -Name AsBuiltReport.Microsoft.Windows -ListAvailable).ModuleBase; Unblock-File -Path $path\*.psd1; Unblock-File -Path $path\Src\Public\*.ps1; Unblock-File -Path $path\Src\Private\*.ps1
-
Close and reopen the PowerShell terminal window.
Note: You are not limited to installing the module to those example paths, you can add a new entry to the environment variable PSModulePath if you want to use another path.
The Microsoft Windows As Built Report utilizes a JSON file to allow configuration of report information, options, detail and healthchecks.
A Microsoft Windows report configuration file can be generated by executing the following command;
New-AsBuiltReportConfig -Report Microsoft.Windows -FolderPath <User specified folder> -Filename <Optional>
Executing this command will copy the default Microsoft Windows report JSON configuration to a user specified folder.
All report settings can then be configured via the JSON file.
The following provides information of how to configure each schema within the report's JSON file.
The Report schema provides configuration of the Microsoft Windows report information.
Sub-Schema | Setting | Default | Description |
---|---|---|---|
Name | User defined | Microsoft Windows As Built Report | The name of the As Built Report |
Version | User defined | 1.0 | The report version |
Status | User defined | Released | The report release status |
ShowCoverPageImage | true / false | true | Toggle to enable/disable the display of the cover page image |
ShowTableOfContents | true / false | true | Toggle to enable/disable table of contents |
ShowHeaderFooter | true / false | true | Toggle to enable/disable document headers & footers |
ShowTableCaptions | true / false | true | Toggle to enable/disable table captions/numbering |
The Options schema allows certain options within the report to be toggled on or off.
Sub-Schema | Setting | Default | Description |
---|---|---|---|
SQLLogin | true / false | false | Enable sql server login authentication . |
SQLUserName | User defined | empty | Sql server login Username . |
SQLSecurePassword | User defined | empty | Sql server login SecureString Password . |
PS C:\> "SecurePassword" | ConvertTo-SecureString -AsPlainText -Force | ConvertFrom-SecureString
01000000d08c9ddf0115d1118c7a00c04fc297eb01000000b3605317d738c346801fbff6596b0d130000
PS C:\>
Copy/Paste the output text to the variable SQLSecurePassword
The InfoLevel schema allows configuration of each section of the report at a granular level. The following sections can be set.
There are 3 levels (0-2) of detail granularity for each section as follows;
Setting | InfoLevel | Description |
---|---|---|
0 | Disabled | Does not collect or display any information |
1 | Enabled | Provides summarized information for a collection of objects |
2 | Adv Summary | Provides condensed, detailed information for a collection of objects |
The table below outlines the default and maximum InfoLevel settings for each section.
Sub-Schema | Default Setting | Maximum Setting |
---|---|---|
Hardware | 1 | 1 |
OperatingSystem | 1 | 2 |
Storage | 1 | 1 |
Networking | 1 | 1 |
IIS | 1 | 1 |
HyperV | 1 | 1 |
DHCP | 1 | 2 |
DNS | 1 | 2 |
FailOverCluster | 1 | 2 |
SQLServer | 1 | 2 |
The Healthcheck schema is used to toggle health checks on or off.
There are a few examples listed below on running the AsBuiltReport script against a Microsoft Windows server target. Refer to the README.md
file in the main AsBuiltReport project repository for more examples.
# Generate a Microsoft Windows As Built Report for Server 'win-server-01v.contoso.local' using specified credentials. Export report to HTML & DOCX formats. Use default report style. Append timestamp to report filename. Save reports to 'C:\Users\Jon\Documents'
PS C:\> New-AsBuiltReport -Report Microsoft.Windows -Target 'win-server-01v.contoso.local' -Username '[email protected]' -Password 'P@ssw0rd' -Format Html,Word -OutputFolderPath 'C:\Users\Jon\Documents' -Timestamp
# Generate a Microsoft Windows As Built Report for Server 'win-server-01v.contoso.local' using specified credentials and report configuration file. Export report to Text, HTML & DOCX formats. Use default report style. Save reports to 'C:\Users\Jon\Documents'. Display verbose messages to the console.
PS C:\> New-AsBuiltReport -Report Microsoft.Windows -Target 'win-server-01v.contoso.local' -Username '[email protected]' -Password 'P@ssw0rd' -Format Text,Html,Word -OutputFolderPath 'C:\Users\Jon\Documents' -ReportConfigFilePath 'C:\Users\Jon\AsBuiltReport\AsBuiltReport.Microsoft.Windows.json' -Verbose
# Generate a Microsoft Windows As Built Report for Server 'win-server-01v.contoso.local' using stored credentials. Export report to HTML & Text formats. Use default report style. Highlight environment issues within the report. Save reports to 'C:\Users\Jon\Documents'.
PS C:\> $Creds = Get-Credential
PS C:\> New-AsBuiltReport -Report Microsoft.Windows -Target 'win-server-01v.contoso.local' -Credential $Creds -Format Html,Text -OutputFolderPath 'C:\Users\Jon\Documents' -EnableHealthCheck
# Generate a Microsoft Windows As Built Report for Server 'win-server-01v.contoso.local' using specified credentials. Export report to HTML & DOCX formats. Use default report style. Reports are saved to the user profile folder by default. Attach and send reports via e-mail.
PS C:\> New-AsBuiltReport -Report Microsoft.Windows -Target 'win-server-01v.contoso.local' -Username '[email protected]' -Password 'P@ssw0rd' -Format Html,Word -OutputFolderPath 'C:\Users\Jon\Documents' -SendEmail
- Issues with WinRM when using the IP address instead of the "Fully Qualified Domain Name".
- The report provides the ability to extract the configuration of the DNS/DHCP/Hyper-V/IIS/FailOver-Cluster services. In order to obtain this information it is required that the servers running these services have the corresponding powershell modules installed.
- Issues when running the report against Windows Server 2012 and 2012 R2.
- Error: "Exception calling Save with 1 argument(s): hexadecimal value 0x00, is an invalid character."