In this blog I will be talking about how to automate the creation of documentation reports of our virtual infrastructure. There are several commercial solutions to generate this type of report but I will be talking about “As Built Report” a free tool that uses powershell as a base to build the reports.
The “As Built Report” tool uses the VMware.PowerCLI modules that we explained previously in our blog. If you want to know more about PowerCLI follow this link here. An important fact about “As Built Report” is that it is not only used to generate reports on VMware but also supports the following products:
- VMware vSphere, NSX & SRM
- Cisco UCS Manager
- Nutanix Prism Element
- Pure Storage FlashArray
- Dell/EMC VxRail
- Cohesity DataPlatform
First of all to use this tool we need to validate the requirements that in general consist of the following:
- Windows PowerShell 5.1 o later
To install the “As Built Report” powershell module use the command <Install-Module> followed by the module name AsBuiltReport.
PS /home/blabla> Install-Module -Name AsBuiltReport Untrusted repository You are installing the modules from an untrusted repository. If you trust this repository, change its InstallationPolicy value by running the Set-PSRepository cmdlet. Are you sure you want to install the modules from 'PSGallery'? [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): A PS /home/blabla>
An optional requirement is to build a configuration file that allows you to set the organization parameters that are used to generate the report. This process generates a JSON file which is used as a template so that you do not have to fill in repetitive information when generating reports. To view the configuration procedure, simply click on the “+” icon.
Finally, we generate the report using the <New-AsBuiltReport> command with the vCenter information parameters and referencing the JSON file we have created as templates.
PS C:\WINDOWS\system32> New-AsBuiltReport -Report VMware.vSphere -Target vcenter-01v.zenprsolutions.local -Username firstname.lastname@example.org -Password XXXXX -Format Word,Text,HTML -OutputFolderPath 'C:\Users\jocolon\OneDrive\Desktop\' -EnableHealthCheck -AsBuiltConfigFilePath 'HomeLab VMware Report.json' -ReportConfigFilePath 'ReportConfig.json' VMware vSphere As Built Report 'VMware vSphere As Built Report' has been saved to 'C:\Users\jocolon\OneDrive\Desktop\'. PS C:\WINDOWS\system32>
Once the process of collecting the information from the vCenter is finished, the command saves the report as specified with the <OutputFolderPath> parameter. The following image shows the generated report in the <Word,Text,HTML> format.
Below I show you some images showing the result of the report collected from the vCenter <vcenter-01v>:
In this lab we learned how easy it is to create documentation about our virtual infrastructure by using freely available tools. “As Built Report” is a robust tool that facilitates the manual process of creating or updating our documentation.