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

Wayfarer

Re: Releasing the Nutanix Documentation Script

 

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

 

Adventurer

Re: Releasing the Nutanix Documentation Script

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

Wayfarer

Re: Releasing the Nutanix Documentation Script

That did the trick. Thank you much.

Wayfarer

Re: Releasing the Nutanix Documentation Script

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
    }

Adventurer

Re: Releasing the Nutanix Documentation Script

I'll test it again on 4.7 when I'm back in the office.
Adventurer

Re: Releasing the Nutanix Documentation Script

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
    }
Wayfarer

Re: Releasing the Nutanix Documentation Script

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
    }