Current Version: 1.8 – Download here.
*Note: If you are using PowerCLI v6.5 R1 OR the PCLI modules from PoSH Gallery, Please use the script v1.8 or later!*
- vCenter server 5.x or later
- PowerCLI 5.1 or later
- PowerShell 3 or later
- Microsoft Word if you wish to output a Word document
v1.8 parameter list specific to the VMware script:
- -VIServerName – mandatory; enter the FQDN of your vCenter server
- -HTML, -MSWord, -Text – select one output format; MSWord is default (note that Word is required to be installed)
- -Full – overrides the default summary mode and includes a full inventory of virtual machines, host and VM networking, etc
- -Export – will export all of the raw data into an ‘export’ directory local to where the script resides to be used later to generate a properly formatted output; use for example when Word is not installed on the machine from where the script is being run; use in conjunction with -Import
- -Import – once the ‘Export’ directory has been generated and copied, run the script again on a machine with Word installed and the Export directory in the same directory as the script; specify an output format
- -PCLICustom – allows you to select a scripts directory for PowerCLI when it is not installed in the default location
- Note: there are several other parameters that the script uses to manipulate the output file or send the report via email, for example. See the full help text for more examples (Get-Help .\VMware_Inventory.ps1)
- An ‘issues’ run mode to include the following: (target: v1.7)
- VM\backing file name mismatch
- VM snapshots
- Mounted CDROM in VM
- Hosts with mismatch cluster storage
- Down hosts, maintenance mode hosts
- Resource usage >85%
- Host build mismatch in cluster
- More robust charting, support for Import\Export and support for HTML output (target: v2.0)
# Disconnect-VIServer if Word is open after connecting, etc
# Fixed path for PCLI 6.5 ..\Infrastructure\PowerCLI\..
# Fix for PowerCLI module install from Gallery and Get-PowerCLIVersion deprecation
#-Added several advanced settings for VMs and VMHosts
#-Updated to ScriptTemplate 21-Feb-2016
#Version 1.5.1 July 20, 2015
#-Cleaned up some extra PCLI calls – set to variables
#-Removed almost all of the extra PCLI verbose messages – Thanks @carlwebster!!
#-Set Issues parameter to disable full run
#Version 1.5 July 14, 2015
#-Added vCenter permissions and non-standard roles
#-Added DRS Rules and Groups
#Version 1.4 June 1, 2015
#-Reworked HTML general and table functions
#-Full HTML output now functional
#-Added fix for closing Word with PDF file
#Version 1.3 April 9, 2015
#-Added support for PowerCLI 6.0
#-Used latest script template
#Version 1.2 January 7, 2015
#-Added Import and Export functionality to output all data to XML that can be taken offline to generate a document at a later time
#Version 1.1 December 16, 2014
#-Fix for help text region tags, fixes from template script for save as PDF, fix for memory heatmap
#-Added VCenter plugins
#Version 1.0 script
#originally released to the community on December 11, 2014
#-Fixed Get-Advanced parameters
#-Added Heatmap legend table, DSN for Windows VCenter, left-aligned tables, VCenter server version
#-Added heatmaps for summary tables; host block storage connections; basic DVSwitching support
#-Fixed multi column table width; fixed 32\64 OS path to PCLI
#-Set summary to default, added -Full parameter for full inventory
#-Swapped table formats for host and standard vSwitches
#-Any Gets used more than once made global
#-Fixed empty cluster
#-Finished text formatted output (no summary, compressed tables)
#-Added NTP service, licensing, summary page, check for PowerCLI version
#-Added SSH service status, syslog log directory on hosts
#-Added VMware email settings, global settings section
#-Added VM Snapshot count
#-Fix for multiple IPs on VM
Announcing the VMware vSphere PowerShell Documentation Script!
In previous deployments of VMware products (and many other products, really), I had used a few tools to generate some form of documentation, but for the most part, the end customer deliverable was completed by hand.
Enter Carl Webster and his XenApp documentation script. All it required was the XenApp SDK and voila! A beautifully formatted Word document that outlined the entire XenApp farm – all by running a single PowerShell script.
All of my past scripting had been in VBScript, and I knew that times were changing and everything was going the way of PowerShell – change is difficult. I forced myself to try to learn a bit of PowerShell here and there, but didn’t quite have it down like I wanted to. I was looking for an opportunity to solidify my PowerShell knowledge and get away from that “archaic” VBScript – this is that opportunity.
Carl not only provided the ‘Webster Documentation Framework’ that this script uses but has been a HUGE help in getting this done – not to mention the several others that helped with the Framework itself. That being said, this script will be housed on carlwebster.com in the documentation scripts repository.
I will tell you that there is a TON of information, configuration, and settings found in vCenter, the hosts, datastores, networks, VMs…the list goes on. This documentation is what I and others feel are a good collection of settings that are important and need to be documented. I’m sure there are more – and if you’d like for them to be added to the script, just leave a comment!
Here’s What You Get
The following items are documented in the default run mode:
- vCenter Summary
- Cluster, host and datastore summary
- Basic vCenter Server settings
- DSN information
- SMTP settings
- Statistics levels
- HA configuration
- DRS configuration
- Hosts in the cluster
- Resource Polls
- VMs in the resource pool
- Hardware configuration
- Key service status
The following items are documented in the full run mode:
- All items in the default run mode
- Host networking
- Adapter settings
- Standard vSwitching
- vSwitch settings
- VMs plugged in to the vSwitch
- Distributed vSwitching
- vSwitch settings
- VMs plugged in to the vSwitch
- Datastore settings
- Hosts connected to the datastore
- Virtual Machines
- VM settings
The Word output looks like this:
What You Need
- The script (available here)
- PowerShell v3 or higher
- PowerCLI v5.1 or higher (available here)
- vCenter Server 5.x (Windows or VSA)
- Microsoft Word for Word and PDF files
- Credentials with read access to all objects in vCenter
- Use the command line argument -VIServerName vCenterServerHere to specify your vCenter server – otherwise, the script will prompt for it
- If you are running the script with an account that has credentials to the vCenter server, you will not be prompted and PowerCLI will use your session credentials – otherwise the script will prompt for credentials
- If you run the script from a workstation and user account that has remote registry permissions to a Windows vCenter server, the DSN will be included in the report. The VSA does not have this capability currently.
Depending on the size of your environment, this script can take A LONG TIME to run. By default, the script will run in ‘summary mode’ (see above) but if you need to run in ‘full mode’ to gather more data, it will take EVEN LONGER. Why does it take so long especially in Full mode? The Word output is generating a beautifully formatted table in Word for every single Host, Network, vSwitch, VM…you get the idea. How can you speed up the execution time? Running the script in -Text mode will run much faster. Alternatively, if you are running Windows 8.1, you can use PowerShell v5 which has shown improvements of up to 80% (WMF\PS5 available here)
Where to Get the Script
The VMware Inventory script is stored in Carl Webster’s documentation script repository – http://carlwebster.com/where-to-get-copies-of-the-documentation-scripts/ There are a ton of other scripts to document Citrix XenApp, Microsoft DHCP, and many others.
18 thoughts on “vCenter Documentation Script”
Excellent script! As someone who doesn’t have the Powershell chops you possess I have found it difficult to keep up to date with documentation. This is a life saver.
I do have one problem though. The Virtual Machine Port Groups comes out empty no matter what I do. I’m using ESXi 5.5, vCenter on level, PS4 and Word 2013. The information is in the .xml file but doesn’t get transferred into the report document.
Any ideas I could look at to fix it?
Let me take a look at it real quick – I may ask you to send the exported XML files or run a few commands. I’ll get back to you. Thanks for the feedback!
Only thing is that it does not work with PowerCLI 6.5 R1 because it won’t recognize this version and just exit out telling you that PowerCLI is not installed.
Seems to work fine with PowerCLI 6.3 R1.
I’m also having issues with PowerCli 6.5 R1 – I’ll try what Andrea suggests
I can confirm that it works with PowerCli 6.3 R1
If you are having issues with PowerCLI 6.5R1, please read the note at the top of this page and use the -PCLICustom parameter with the script.
Excellent script, just a couple of additions i would love to see…
Could there be an option to add the CDP/LLDP properties for each vnic on the hosts, and to also add the IP Addresses for each of the VMs?
I’m running PowerCLI 6.5 installed as a module and I can’t find the folder that will allow me to run this script as nothing is in Program Files or Program Files (x86)
Closest I could find was
but the script didn’t like that
Thank you for the effort you put into this, this script is somehow what I was looking for. Yet I’m unable to execute it properly because after ~40 seconds the execution stops.
This is how the script ends:
VERBOSE: 09/12/2017 11:51:59: Gathering Compute data
Get-VMHostService : 9/12/2017 11:52:39 AM Get-VMHostService Object
reference not set to an instance of an object.
+ $Script:HostServices = Get-VMHostService -VMHost * 4>$Null
+ CategoryInfo : NotSpecified: (:) [Get-VMHostService], VimExcept
+ FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomatio
VERBOSE: 09/12/2017 11:52:39: Gathering Virtual Machine data
This script directly outputs to Microsoft Word, please install Microsoft Word
I know I don’t have Word installed on the machine, so this wouldn’t work as well as generating a PDF file. Nevertheless I believe that the above error message doesn’t have anything to do with this.
OS is Windows Server 2012 R2
PowerCLI is 6.3 Release 1
Do you have an idea why this happens? I’m not as good in programming so I probably won’t be able to fix it myself :-/
Thanks in advance!
Really great script . . .
I would like to use it with a scheduled Task and this also works as long that I use the Output as Text or HTML. I I’m using PDF or MSWord it never Ends, it starts WinWord.exe and then the Task runs forever.
It seems, that I’m not able to use this script togehter with WinWord.
Are there any IdeaS?
unfortunately the script isn´t working with the new “PowerCLI in Powershell Gallery” thingy. Would be really nice to get that working again.
Thanks in advance
Thanks for the note- I’m working on a new version that supports that as well as includes the new install location for PCLI 6.5
Hi Jacob, do you have a timeline for this update? Looking forward to it. Thanks!
Version 1.8 is now available – it will work with PCLI installed from PoSH Gallery as well as PCLI 6.5R1 and later.
Really amazing script . . .
Is it possible to add more information?
Hosts: DNS/NTP, Firmware HBA/NIC, Hosts SSL-Certificates
vCenter: Datacenter, SSO-Domain, Machine-SSL-Certificates
Thanks in advance John
Is it possible to gather data from a specific datacenter or Cluster rather then have the complete vCenter scanned?
That would be great.
Thanks in advance
Thank you so much for this script. Is there a way to disable SSL certificate verification? I’m getting the following warning and may not be able to update the certificates on the system I’m trying to query.
Connecting to vCenter failed with the following error: The SSL connection could not be established, see inner exception. This script will now exit.
Connecting to really old vSphere clusters that don’t support modern ciphers, I had to selectively enable TLSv1 to be able to connect.
Solution detailed here: https://medium.com/siberians-pro/how-to-use-tlsv1-on-ubuntu-20-04-133c2898ad7