vDocumentation: Check Out These Scripts To Automate Your Documentation!
- Ben Liebowitz
- 0
- 1354
Now that VMworld 2017 US has come to a close, many of the sessions are already up on youtube to watch.
One of the ones I watched yesterday was SER2077BU – Achieve Maximum vSphere Stability with PowerCLI Assisted Documentation. My friend, Ariel Sanchez Mora (@arielsanchezmor), and his friend, Edgar Sanchez (@EdmSanchez13), put together these scripts to automatically document your environment. I HIGHLY recommend you check these scripts out! Also, please send them a tweet or DM as they’re looking for feedback, feature requests, etc!
You can grab it from the PowerShell Gallery too! Check out the instructions on how to get it and what prerequisites you need at their github page below.
https://github.com/arielsanchezmora/vDocumentation
There are 4 separate scripts to document your environment.
Get-ESXInventory
Get-ESXNetworking
Get-ESXStorage
Get-ESXIODevice
Each of these can be pointed at your entire vCenter, or broken down by datacenter, cluster, or one specific host. It can export to CSV or XLSX (and Excel does not need to be installed). You can also specify only running it for one of the tabs (such as CONFIGURATION for the Get-ESXInventory script) or leave that switch out and have it generate everything (my recommendation).
Here are examples of some of the output you’ll see in Excel. MAKE SURE TO CHECK OUT THE DIFFERENT TABS!
(p.s.) I changed some of the info like WWNs, MAC Addresses, IPs, etc. 🙂
Get-ESXStorage -esxi ESX01 -ExportExcel -FolderPath e:\ben
Get-ESXInventory -esxi ESX01 -ExportExcel -FolderPath e:\ben
Get-ESXNetworking -esxi ESX01 -ExportExcel -FolderPath e:\ben
Get-ESXIODevice -esxi ESX01 -ExportExcel -FolderPath e:\ben
To run it against your entire environment, just remove the TARGET switch (-esxi, -cluster, -datastore) and it’ll gather info on whichever vCenter you’re connected to! Check out this script that I will be scheduling to run monthly. It will connect to each of my vCenter servers, and store each file into the folder with the vCenter name, which to keep everything separate and keep it from overwriting files as it runs.
################################################### # # PowerCLI Script Document the vSphere Environment # Written by BLiebowitz on 9/1/2017 # ################################################### # Build array for each vCenter you wish to document $array = "vCenter01", "vCenter02", "vCenter03" $sum = @() for($count=0;$count -lt $array.length; $count++) { # Connect to All vCenter Servers, one at a time. connect-viserver $array[$count] # Get Storage Documentation Get-ESXStorage -ExportExcel -FolderPath E:\Ben\VMware\Documentation\$($array[$count])\ # Get Inventory Documentation Get-ESXInventory -ExportExcel -FolderPath E:\Ben\VMware\Documentation\$($array[$count])\ # Get Network Documentation Get-ESXNetworking -ExportExcel -FolderPath E:\Ben\VMware\Documentation\$($array[$count])\ # Get IO Device Documentation Get-ESXIODevice -ExportExcel -FolderPath E:\Ben\VMware\Documentation\$($array[$count])\ # Disconnect from vCenter Servers disconnect-viserver $array[$count] -confirm:$false }
I hope you find this as useful as I did!
Ben Liebowitz, VCP, vExpert
NJ VMUG Leader