vCenter Documentation Script

Current Version: 1.7 Download here.

*Note: If you are using PowerCLI v6.5 R1, the installation location has changed. I am working on updating the scripts location in the script for automated loading, but in the meantime, use the ‘-PCLICustom’ parameter to select the new location. The new location changed the directory from ‘vSphere PowerCLI’ to just ‘PowerCLI’

v1.7 requirements:

  • 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.7 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)

Upcoming features:

  • 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)

ChangeLog

#Version 1.6
#-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
#-Beta charting

#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

#Version 0.4
#-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

#Version 0.3
#-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

#Version 0.2
#-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
    • Licensing
  • Clusters
    • HA configuration
    • DRS configuration
    • Hosts in the cluster
  • Resource Polls
    • Settings
    • VMs in the resource pool
  • Hosts
    • 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
  • Datastores
    • 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

Notes

  • 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.

Important

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.

6 thoughts on “vCenter Documentation Script

  1. 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?

    Thanks

  2. Hi Davis,

    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!

  3. Hi,

    great script!

    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.

  4. 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.

Leave a Reply