This tool is most excellent. It is a collection of scripts that can produce detailed, or more detailed, or most detailed reports of your vSphere environment.
I should mention that when I use setting 2 for detail I get a Word document that is 9 pages long but when I use the default of 3, I get a report of 114 pages. But very good info and useful for a variety of reasons – such as DR, or helping with patching or VMware Tools updates. If I was still an SE for partners I would be using this script every time I finished working at a customer so I could also compare between when I finished the work and when I showed up to help troubleshoot.
Anyone is is experienced with PowerShell / PowerCLI is going to find it pretty easy. But I am a beginner, and I have not worked with JSON before so I stumbled a bit. So I am going to share a little bit of into to help people that might stumble as well.
- Unzip the master zip you get from this link in your scripts folder. Make sure you get the script from the Master branch and not the default dev branch. On the left side of the screen is a drop down that you can select master, and the download button is on the right
- Now on each .ps1 file you need to right+click and select Properties and check unblock. There are a number of .ps1 files in a variety of folders. (The last time I installed As Built I did not have to do this.)
- At the PowerShell prompt use install-module PScribo and let it install.
- Create a folder c:\reports to catch the reports you do. You can use a different path if you like.
Be aware that your default setting of detail 3 is going to make a big HTML or doc file. But it is very useful and you will see how to tweak that below.
Execution – first
The command below is what you need to use the first time. And answer all the questions like your name, email and the like.
.\New-AsBuiltReport.ps1 -Target your_VC_FQDN -Credential (get-credential) -Type vSphere -Format HTML,Word -Path ‘C:\reports’ -TimeStamp -Healthchecks
You can change the C:\Reports to what you need. I really like the TimeStamp feature as it means reports will not overwrite each other!
This will build out a file with your configuration so that it can be referenced at execute time to minimize the questions. The filename is AsBuiltReport.json. This json will be in the same folder as the New ps1 file.
Execution – next time
This will not prompt you for things but rather just execute. You can always start as above to reenter your configuration.
.\New-AsBuiltReport.ps1 -Target Your_VC_FQDN -Credential (get-credential) -Type vSphere -Format HTML,Word -Path ‘C:\reports’ -TimeStamp -Healthchecks -AsBuiltConfigPath AsBuiltReport.json
Changing Level of Detail
As I mentioned my first run gave me a report on my vSphere Infrastructure that was most excellent but also 114 pages. I wanted less detail.
- Change from your As-Built-Report-master folder to Reports \ vSphere.
- Use Notepad++ or something similar to edit the vSphere.json file. It will look something like below.
In the InfoLevel area you can see above all the 2’s that I changed from 3 – and went from 114 pages to 9. Also notice the 0’s as I do not have NSX or SRM. You can change the number to what works for you and save the json file and the next run of the script will use the new values.
You can put a second vCenter on the target line – which would make it look like:
.\New-AsBuiltReport.ps1 -Target Your_VC_FQDN,Other_vC_FQDN -Credential (get-credential) -Type vSphere -Format HTML,Word -Path ‘C:\reports’ -TimeStamp -Healthchecks -AsBuiltConfigPath AsBuiltReport.json
This should get you going, but if you have questions or comments let me know.
- 3/12/19 – added the info on how you can do multiple vCenters.
- 3/9/19 – used the latest version – as of today – PowerCLI, Powershell, and the As Built scripts. Also fixed some typos and grammar. I also noticed the vSphere JSON has a default of 3’s now where it used to be 2’s so that is a nice change – so my 114 page report is now 34.
=== END ===