Scripts

Welcome to the Nutanix NEXT community. To get started please read our short welcome post. Thanks!

cancel
Showing results for 
Search instead for 
Did you mean: 

Releasing the Nutanix Documentation Script

Community Manager

Releasing the Nutanix Documentation Script

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.

Syntax
The 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

 

Requirements
On 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:

 

kees-5.jpg

Release notes
This 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 enhancements
For 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

Tags (1)
16 REPLIES
Explorer

Re: Releasing the Nutanix Documentation Script

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 Word
VERBOSE: 07/27/2015 17:24:17: System Cleanup
VERBOSE: 07/27/2015 17:24:17: Script has completed
VERBOSE: 07/27/2015 17:24:17:
WARNING: 07/27/2015 17:24:17: Unable to save the output file, C:\Users\mcaluwaerts\Desktop\Nutanix Documentation
Script.docx
C:\Users\mcaluwaerts\Desktop\Nutanix_Documentation_Script_v1_signed.ps1 : Unable to save the output file, C:\Users\mcal
uwaerts\Desktop\Nutanix Documentation Script.docx
At line:1 char:1
+ .\Nutanix_Documentation_Script_v1_signed.ps1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (Smiley Happy [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:00
VERBOSE: 07/27/2015 17:24:17: Script ended: 07/27/2015 17:24:17
VERBOSE: 07/27/2015 17:24:17: Elapsed time: 0 days, 0 hours, 1 minutes, 17.521 seconds
PS C:\Users\mcaluwaerts\Desktop>

 

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

 

Thanks a lot in advance!

Mathias

Nutanix Employee

Re: Releasing the Nutanix Documentation Script

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

Kind regards,

Kees
Explorer

Re: Releasing the Nutanix Documentation Script

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:\Users\mcaluwaerts\Desktop\Nutanix_Documentation_Script_v1_signed.ps1 : Unable to save the output file, C:\Users\mcal
uwaerts\Desktop\Nutanix Documentation Script.html
At line:1 char:1
+ .\Nutanix_Documentation_Script_v1_signed.ps1 -nxIP 10.32.30.100 -nxUser Admin -n ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (Smiley Happy [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

Nutanix Employee

Re: Releasing the Nutanix Documentation Script

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. 

Kind regards,

Kees
Adventurer

Re: Releasing the Nutanix Documentation Script

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

-----

Highlighted
Adventurer

Re: Releasing the Nutanix Documentation Script

Error when trying to run with Office 365 

 

Trailblazer

Re: Releasing the Nutanix Documentation Script

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 Info
Version Build Version REST API Version
5.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 parameters
VERBOSE: 02/27/2017 15:06:22: MSWord is set
VERBOSE: 02/27/2017 15:06:22: CoName is
VERBOSE: 02/27/2017 15:06:22: Setting up Word
VERBOSE: 02/27/2017 15:06:22: Create Word comObject.
VERBOSE: 02/27/2017 15:06:23: Determine Word language value
VERBOSE: 02/27/2017 15:06:23: Word language value is 1033
VERBOSE: 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:\Software\Microsoft\Office\Common\UserInfo 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 : Sideline
VERBOSE: 02/27/2017 15:06:24: User Name : Administrator
VERBOSE: 02/27/2017 15:06:24: Save As PDF : False
VERBOSE: 02/27/2017 15:06:24: Save As TEXT : False
VERBOSE: 02/27/2017 15:06:24: Save As WORD : True
VERBOSE: 02/27/2017 15:06:24: Save As HTML : False
VERBOSE: 02/27/2017 15:06:24: Add DateTime : False
VERBOSE: 02/27/2017 15:06:24: Filename1 : C:\psscript\Nutanix Documentation Script.docx
VERBOSE: 02/27/2017 15:06:24: OS Detected : Microsoft Windows Server 2016 Standard
VERBOSE: 02/27/2017 15:06:24: PSUICulture : en-US
VERBOSE: 02/27/2017 15:06:24: PSCulture : de-DE
VERBOSE: 02/27/2017 15:06:24: Word version :
VERBOSE: 02/27/2017 15:06:24: Word language: 1033
VERBOSE: 02/27/2017 15:06:24: PoSH version : 5.1.14393.206
VERBOSE: 02/27/2017 15:06:24:
VERBOSE: 02/27/2017 15:06:24: Script start : 02/27/2017 15:06:22
VERBOSE: 02/27/2017 15:06:24:
VERBOSE: 02/27/2017 15:06:24:
VERBOSE: 02/27/2017 15:06:24: Load Word Templates
VERBOSE: 02/27/2017 15:06:26: Attempt to load cover page Sideline
VERBOSE: 02/27/2017 15:06:26: Create empty word doc
VERBOSE: 02/27/2017 15:06:27: Disable grammar and spell checking
VERBOSE: 02/27/2017 15:06:27: Insert new page, getting ready for table of contents
VERBOSE: 02/27/2017 15:06:27: Table of Contents - Automatic Table 2
VERBOSE: 02/27/2017 15:06:27: Set the footer
VERBOSE: 02/27/2017 15:06:27: Get the footer and format font
VERBOSE: 02/27/2017 15:06:28: Footer text
VERBOSE: 02/27/2017 15:06:28: Add page numbering
VERBOSE: 02/27/2017 15:06:28:
VERBOSE: Performing the operation "Set Alias" on target "Name: installutil Value: C:\Windows\Microsoft.NET\Framework\v4.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 document
VERBOSE: 02/27/2017 15:06:35: Set Cover Page Properties
VERBOSE: 02/27/2017 15:06:36: Update the Table of Contents
VERBOSE: 02/27/2017 15:06:36: Save and Close document and Shutdown Word
VERBOSE: 02/27/2017 15:06:36: Saving DOCX file
VERBOSE: 02/27/2017 15:06:36: Running Word 2013 and detected operating system Microsoft Windows Server 2016 Standard
VERBOSE: 02/27/2017 15:06:37: Closing Word
VERBOSE: 02/27/2017 15:06:38: System Cleanup
VERBOSE: 02/27/2017 15:06:39: Script has completed
VERBOSE: 02/27/2017 15:06:39:
VERBOSE: 02/27/2017 15:06:39: C:\psscript\Nutanix Documentation Script.docx is ready for use
VERBOSE: 02/27/2017 15:06:40:
VERBOSE: 02/27/2017 15:06:40: Script started: 02/27/2017 15:06:22
VERBOSE: 02/27/2017 15:06:40: Script ended: 02/27/2017 15:06:40
VERBOSE: 02/27/2017 15:06:40: Elapsed time: 0 days, 0 hours, 0 minutes, 17.192 seconds
PS C:\psscript>

 

@Oppelman
Nutanix Employee

Re: Releasing the Nutanix Documentation Script

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.

Kind regards,

Kees
Trailblazer

Re: Releasing the Nutanix Documentation Script

Hey @KeesBaggerman,

 

thx for your fast reply Smiley Happy

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

@Oppelman