vCenter Documentation Script

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!*

v1.8 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.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)

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.8
# 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

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

18 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

    Reply
  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!

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

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

    Reply
  5. 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?

    Reply
  6. 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
    C:\Users\UserName\Documents\WindowsPowerShell\Modules\VMware.PowerCLI\6.5.2.6268016

    but the script didn’t like that

    Reply
  7. Hey Jacob!

    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.
    At C:\Users\121212\Downloads\vCenter-documentation-script-v1.72\VMware_Inventor
    y_1_72.ps1:3160 char:32
    + $Script:HostServices = Get-VMHostService -VMHost * 4>$Null
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : NotSpecified: (:) [Get-VMHostService], VimExcept
    ion
    + FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomatio
    n.ViCore.Cmdlets.Commands.Host.GetVMHostService

    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!

    Reply
  8. 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?

    Reply
  9. Hi Jacob,

    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

    Marcel

    Reply
  10. Hi Jake,

    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

    Reply
  11. Hi Jake,

    great Skript.
    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
    Jean

    Reply
  12. Hi Jake,

    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.

    Thanks,

    Reply

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.