Releasing the Nutanix Documentation Script


Userlevel 7
Badge +35
One of the things I’ve been working on since I started at Nutanix is the Nutanix documentation script. Luckily there already is an PowerShell framework to document AD, DHCP but also XenApp, XenDesktop and PVS for instance.

And with the current release of NOS 4.1.1 and Barry Schiffer’ NetScaler Documentation script I figured it would be a good idea to do the same thing for the Nutanix solution. The Nutanix management interface (PRISM) is a very powerful tool to get all information in a general overview.

https://www.youtube.com/watch?v=2YwS8acRXbY

This interface will give you access to both the REST API and the PowerShell CMDlets and these PoSH cmdlets are very useful and well written so I could easily use them in the base script. I wanted to thank both authors of the framework:

  • Carl Webster: Thank you so much for creating the base script and putting so much of your own time into this scripts. It’s guys like you that make the community so much stronger.
  • Iain Brighton: The man that makes writing PoSH scripts and functions look easy and is ever so willingly to help out with all questions (Yes, even the stupid ones). Thanks for all your patience with this scripting novice.

What’s currently in the script
  • New look and feel; Utilizing native Microsoft Word tables;
  • Mandatory items for the Nutanix PRISM interface, username and password;
  • Incorporating all Get- cmdlets into the script.
  • The parameter -full will get all non-resolved alerts and events on the system.
SyntaxThe script is easy to use with just 3 mandatory parameters:

Nutanix_Script_v1_unsigned.ps1 -nxIP 1.1.1.1 -nxUser Admin -nxPassword ****
This will give you a word document which is (by default) called ‘Nutanix Documentation Script’ in the directory where you run the script.

If you want to incorporate all non resolved alerts and events the syntax would be:

Nutanix_Script_v1_unsigned.ps1 -nxIP 1.1.1.1 -nxUser Admin -nxPassword **** -full
RequirementsOn the machine you’d be running the script on you need:
  • Office 2013
  • PoSH 3
  • Nutanix CMDlets (from NOS4.1.1)
  • NOS4.1.1 (it will work on older versions of NOS but it won’t give all the information the script will process when on NOS4.1.1)
The script should be started from the Nutanix CMDlets as this cmdlet icon will automatically load the appropriate commands.

The Nutanix CMDlets can be installed from the PRISM interface:


Release notesThis version of the script will gather and format the following information:
  • Cluster Overview
  • Licensing
  • Node Information
  • Storage Pool(s)
  • Containers
  • vDisks
  • VMs
  • Protection Domain(s)
Next enhancementsFor the next versions of the script I’m looking at the following enhancements:
  • Support for Hyper-V
  • Support for older versions of NOS
The Nutanix documentation script version 1 can be downloaded here: http://carlwebster.com/downloads/download-info/nutanix/

If you have any questions about the scripts or possible feature requests/improvements please don’t hesitate to leave a comment!

This is a repost from the blog My Virtual Vision by Kees Baggerman

17 replies

Badge +7
Hi Kees,

I seem to be having one small problem: when I get to the part where I need to close word ==> the script hangs 😢
When I close word myself (from taskmanager), the script continues but then spits out this error:

VERBOSE: 07/27/2015 17:24:04: Closing WordVERBOSE: 07/27/2015 17:24:17: System CleanupVERBOSE: 07/27/2015 17:24:17: Script has completedVERBOSE: 07/27/2015 17:24:17:WARNING: 07/27/2015 17:24:17: Unable to save the output file, C:UsersmcaluwaertsDesktopNutanix DocumentationScript.docxC:UsersmcaluwaertsDesktopNutanix_Documentation_Script_v1_signed.ps1 : Unable to save the output file, C:UsersmcaluwaertsDesktopNutanix Documentation Script.docxAt line:1 char:1+ .Nutanix_Documentation_Script_v1_signed.ps1+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Nutanix_Documentation_Script_v1_signed.ps1
VERBOSE: 07/27/2015 17:24:17:VERBOSE: 07/27/2015 17:24:17: Script started: 07/27/2015 17:23:00VERBOSE: 07/27/2015 17:24:17: Script ended: 07/27/2015 17:24:17VERBOSE: 07/27/2015 17:24:17: Elapsed time: 0 days, 0 hours, 1 minutes, 17.521 secondsPS C:UsersmcaluwaertsDesktop>

I'm quite new to this but could you point me into the right direction?

Thanks a lot in advance!
Mathias
Userlevel 1
Badge +10
Hi Mathias,

Can you tell us a bit more about your environment? Specifically:

What version of Office are you using?
Are you using language packs for Office?
What NOS version are you using?

I've seen this happening with unsupported Office versions or language packs that are not so common.

Regards,

Kees
Badge +7
Hi Kees,

Thanks for stoppping by! 🙂

The version of Word is 365 ProPlus.
No language packs installed, Dutch proofing-tools.
NOS is 4.1.4

On a side note: I also tried running the scripts with the -html option to try and bypass Word. I still get the write error however:

C:UsersmcaluwaertsDesktopNutanix_Documentation_Script_v1_signed.ps1 : Unable to save the output file, C:UsersmcaluwaertsDesktopNutanix Documentation Script.htmlAt line:1 char:1+ .Nutanix_Documentation_Script_v1_signed.ps1 -nxIP 10.32.30.100 -nxUser Admin -n ...+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Nutanix_Documentation_Script_v1_signed.ps1

If you need any more info ==> please yell!

Kind regards,
Mathias
Userlevel 1
Badge +10
Geen probleem! Responding in english as a reference for others as well, I've tested this with Office 2013 and the Dutch Language Pack (being Dutch myself it made sense) and that worked. Would it be possible to do spin up a VM and try a vanilla (maybe even manual) install of Office?

The HTML option is not working, there's a refresh in the works of the scripting framework that will make the -HTML feature work and do some more, that's still some months out tho.
Badge +5
I've found with the 4.6.1 NutanixCmdlets a minor change is needed to this script, as the password now needs to be a securestring. Here's what i've added.

-----
##Convert password to securestring as required for v4.6.1 nutanix cmdlets - Jason Hall 10.06.2016$nxSecurePassword=ConvertTo-SecureString $nxPassword -AsPlainText -Force
## Steven Potrais - Connecting to the Nutanix node$nxServerObj = Connect-NutanixCluster -Server $nxIP -UserName $nxUser -Password $nxSecurePassword -AcceptInvalidSSLCerts
-----
Badge +7
Error when trying to run with Office 365

Userlevel 1
Badge +11
Hey KeesBaggerman,

seems the cluster connect does no longer work when you have a cluster with AOS5, the document is empty expect the CmdLets version:
Nutanix Cmdlets InfoVersion Build Version REST API Version5.0 2.0-release5.0-dev-12152016 v1
Any hint how to fix this?

THX Thomas

PS C:psscript> .Nutanix_Documentation_Script_v1_Signed.ps1 -nxIP "10.10.10.10" -nxUser "admin" -nxPassword "nutanix/4u"VERBOSE: 02/27/2017 15:06:22: Testing output parametersVERBOSE: 02/27/2017 15:06:22: MSWord is setVERBOSE: 02/27/2017 15:06:22: CoName isVERBOSE: 02/27/2017 15:06:22: Setting up WordVERBOSE: 02/27/2017 15:06:22: Create Word comObject.VERBOSE: 02/27/2017 15:06:23: Determine Word language valueVERBOSE: 02/27/2017 15:06:23: Word language value is 1033VERBOSE: 02/27/2017 15:06:23: Company name is blank. Retrieve company name from registry.WARNING:
Company Name is blank so Cover Page will not show a Company Name.WARNING:Check HKCU:SoftwareMicrosoftOfficeCommonUserInfo for Company or CompanyName value.WARNING:You may want to use the -CompanyName parameter if you need a Company Name on the cover page.
VERBOSE: 02/27/2017 15:06:24: Validate cover page Sideline for culture code en-VERBOSE: 02/27/2017 15:06:24:VERBOSE: 02/27/2017 15:06:24:VERBOSE: 02/27/2017 15:06:24: Company Name :VERBOSE: 02/27/2017 15:06:24: Cover Page : SidelineVERBOSE: 02/27/2017 15:06:24: User Name : AdministratorVERBOSE: 02/27/2017 15:06:24: Save As PDF : FalseVERBOSE: 02/27/2017 15:06:24: Save As TEXT : FalseVERBOSE: 02/27/2017 15:06:24: Save As WORD : TrueVERBOSE: 02/27/2017 15:06:24: Save As HTML : FalseVERBOSE: 02/27/2017 15:06:24: Add DateTime : FalseVERBOSE: 02/27/2017 15:06:24: Filename1 : C:psscriptNutanix Documentation Script.docxVERBOSE: 02/27/2017 15:06:24: OS Detected : Microsoft Windows Server 2016 StandardVERBOSE: 02/27/2017 15:06:24: PSUICulture : en-USVERBOSE: 02/27/2017 15:06:24: PSCulture : de-DEVERBOSE: 02/27/2017 15:06:24: Word version :VERBOSE: 02/27/2017 15:06:24: Word language: 1033VERBOSE: 02/27/2017 15:06:24: PoSH version : 5.1.14393.206VERBOSE: 02/27/2017 15:06:24:VERBOSE: 02/27/2017 15:06:24: Script start : 02/27/2017 15:06:22VERBOSE: 02/27/2017 15:06:24:VERBOSE: 02/27/2017 15:06:24:VERBOSE: 02/27/2017 15:06:24: Load Word TemplatesVERBOSE: 02/27/2017 15:06:26: Attempt to load cover page SidelineVERBOSE: 02/27/2017 15:06:26: Create empty word docVERBOSE: 02/27/2017 15:06:27: Disable grammar and spell checkingVERBOSE: 02/27/2017 15:06:27: Insert new page, getting ready for table of contentsVERBOSE: 02/27/2017 15:06:27: Table of Contents - Automatic Table 2VERBOSE: 02/27/2017 15:06:27: Set the footerVERBOSE: 02/27/2017 15:06:27: Get the footer and format fontVERBOSE: 02/27/2017 15:06:28: Footer textVERBOSE: 02/27/2017 15:06:28: Add page numberingVERBOSE: 02/27/2017 15:06:28:VERBOSE: Performing the operation "Set Alias" on target "Name: installutil Value: C:WindowsMicrosoft.NETFrameworkv4.0.30319\installutil".Not connected to any server. Please connect to a server and try again.Not connected to any server. Please connect to a server and try again.Not connected to any server. Please connect to a server and try again.Not connected to any server. Please connect to a server and try again.Not connected to any server. Please connect to a server and try again.Not connected to any server. Please connect to a server and try again.Not connected to any server. Please connect to a server and try again.Not connected to any server. Please connect to a server and try again.Not connected to any server. Please connect to a server and try again.Not connected to any server. Please connect to a server and try again.Not connected to any server. Please connect to a server and try again.Not connected to any server. Please connect to a server and try again.Not connected to any server. Please connect to a server and try again.Not connected to any server. Please connect to a server and try again.Not connected to any server. Please connect to a server and try again.Not connected to any server. Please connect to a server and try again.Not connected to any server. Please connect to a server and try again.Not connected to any server. Please connect to a server and try again.Not connected to any server. Please connect to a server and try again.Not connected to any server. Please connect to a server and try again.Not connected to any server. Please connect to a server and try again.Not connected to any server. Please connect to a server and try again.VERBOSE: 02/27/2017 15:06:35: Finishing up documentVERBOSE: 02/27/2017 15:06:35: Set Cover Page PropertiesVERBOSE: 02/27/2017 15:06:36: Update the Table of ContentsVERBOSE: 02/27/2017 15:06:36: Save and Close document and Shutdown WordVERBOSE: 02/27/2017 15:06:36: Saving DOCX fileVERBOSE: 02/27/2017 15:06:36: Running Word 2013 and detected operating system Microsoft Windows Server 2016 StandardVERBOSE: 02/27/2017 15:06:37: Closing WordVERBOSE: 02/27/2017 15:06:38: System CleanupVERBOSE: 02/27/2017 15:06:39: Script has completedVERBOSE: 02/27/2017 15:06:39:VERBOSE: 02/27/2017 15:06:39: C:psscriptNutanix Documentation Script.docx is ready for useVERBOSE: 02/27/2017 15:06:40:VERBOSE: 02/27/2017 15:06:40: Script started: 02/27/2017 15:06:22VERBOSE: 02/27/2017 15:06:40: Script ended: 02/27/2017 15:06:40VERBOSE: 02/27/2017 15:06:40: Elapsed time: 0 days, 0 hours, 0 minutes, 17.192 secondsPS C:psscript>

Userlevel 1
Badge +10
Take a look at line 2294 in the script:
$nxServerObj = Connect-NutanixCluster -Server $nxIP -UserName $nxUser -Password $nxPassword -AcceptInvalidSSLCerts

To succesfully connect to the cluster it should be changed to:
$nxServerObj = Connect-NTNXCluster -Server $nxIP -UserName $nxUser -Password $nxPassword -AcceptInvalidSSLCerts

We've changed the connect-nutanixcluster to connect-ntnxcluster resulting in a failed connection, I need to find some time to update the script with some error handling and use both methods.
Userlevel 1
Badge +11
Hey KeesBaggerman,

thx for your fast reply 🙂
A combination of both worked for me, thx to NoDowt for the $nxSecurePassword string.

##Convert password to securestring as required for v4.6.1 nutanix cmdlets - Jason Hall 10.06.2016$nxSecurePassword=ConvertTo-SecureString $nxPassword -AsPlainText -Force
## Steven Potrais - Connecting to the Nutanix node$nxServerObj = Connect-NTNXCluster -Server $nxIP -UserName $nxUser -Password $nxSecurePassword -AcceptInvalidSSLCerts

Greetz Thomas
Badge

Cmdlets ver: 4.7
NOS ver: 4.7.4
Script ver 1.1


Getting an unpopulated report and the following errors:

Not connected to any server. Please connect to a server and try again.


Dont quite understand the stated resolution

Badge +5
I haven't tried it on 4.7, but most likely you'll just need to edit the script as per my details to use the securestring for the password...

Search the script file for "## Steven Potrais - Connecting to the Nutanix node"
Then, just above it add this:
##Convert password to securestring as required for v4.6.1 nutanix cmdlets - Jason Hall 10.06.2016$nxSecurePassword=ConvertTo-SecureString $nxPassword -AsPlainText -Force

Then change the line under "## Steven Potrais - Connecting to the Nutanix node" to this:$nxServerObj = Connect-NutanixCluster -Server $nxIP -UserName $nxUser -Password $nxSecurePassword -AcceptInvalidSSLCerts

Cheers
Jason
Badge
That did the trick. Thank you much.
Badge
Sorry, I jumped the gun. I am getting the same connection errors. Below is the modifications I made to the script per your instructions. Is this correct? (Note some of the previous lines were commented out instead of deleted)

# Checking Nutanix cmdlets version and connect to the cluster accordingly$loadedsnapins= Get-PSSnapin -Name NutanixCmdletsPSSnapin if($loadedsnapins.PSVersion.Major -eq "5"){ ##Convert password to securestring as required for v4.6.1 nutanix cmdlets - Jason Hall 10.06.2016 $nxSecurePassword=ConvertTo-SecureString $nxPassword -AsPlainText -Force ## Steven Potrais - Connecting to the Nutanix node pre-AOS 5 $nxServerObj = Connect-NutanixCluster -Server $nxIP -UserName $nxUser -Password $nxSecurePassword -AcceptInvalidSSLCerts ##$nxServerObj = Connect-NTNXCluster -Server $nxIP -UserName $nxUser -Password $nxPassword -AcceptInvalidSSLCerts } else { $nxServerObj = Connect-NutanixCluster -Server $nxIP -UserName $nxUser -Password $nxPassword -AcceptInvalidSSLCerts }
Badge +5
I'll test it again on 4.7 when I'm back in the office.
Badge +5
I think I see what's happening... the if statement you've got there is skipping the part setting the secure password as it's only in the version 5 section.Try this (check formatting & typo's.. did this on my phone):# Checking Nutanix cmdlets version and connect to the cluster accordingly$loadedsnapins= Get-PSSnapin -Name NutanixCmdletsPSSnapin##Convert password to securestring as required for v4.6.1 nutanix cmdlets - Jason Hall 10.06.2016 $nxSecurePassword=ConvertTo-SecureString $nxPassword -AsPlainText -Force if($loadedsnapins.PSVersion.Major -eq "5"){ ## Steven Potrais - Connecting to the Nutanix node AOS 5 $nxServerObj = Connect-NTNXCluster -Server $nxIP -UserName $nxUser -Password $nxSecurePassword -AcceptInvalidSSLCerts } else { ## Steven Potrais - Connecting to the Nutanix node AOS 4 $nxServerObj = Connect-NutanixCluster -Server $nxIP -UserName $nxUser -Password $nxSecurePassword -AcceptInvalidSSLCerts }
Badge
Still no connection. Thanks for your help. Below is current script portion

# Checking Nutanix cmdlets version and connect to the cluster accordingly$loadedsnapins= Get-PSSnapin -Name NutanixCmdletsPSSnapin ##Convert password to securestring as required for v4.6.1 nutanix cmdlets - Jason Hall 10.06.2016 $nxSecurePassword=ConvertTo-SecureString $nxPassword -AsPlainText -Force if($loadedsnapins.PSVersion.Major -eq "5"){ ## Steven Potrais - Connecting to the Nutanix node pre-AOS 5 ##$nxServerObj = Connect-NutanixCluster -Server $nxIP -UserName $nxUser -Password $nxSecurePassword -AcceptInvalidSSLCerts $nxServerObj = Connect-NTNXCluster -Server $nxIP -UserName $nxUser -Password $nxPassword -AcceptInvalidSSLCerts } else { $nxServerObj = Connect-NutanixCluster -Server $nxIP -UserName $nxUser -Password $nxPassword -AcceptInvalidSSLCerts }
Dear
I face an issue when I run the script because I have cluster v5.6 and the current script working with cluster 5.5
Thanks
Regards
Ramzi Mad

Reply