Who Me Too'd this topic

About Microsoft Virtualization Discussions
Discuss NetApp solutions for Microsoft Private Cloud and the Hyper-V platform, including FlexPod Datacenter, NetApp OnCommand Plug-in for Microsoft, and Data ONTAP PowerShell Toolkit.

NetApp Powershell Shutdown Script

I have two NA filers that I'm writing a shutdown script to be kicked off by APC PowerChute. Really simple, I just need to Invoke-NaSsh and halt the system. I'm having a problem actually connecting to the filer, though. It appears that the generated PSCredential object (as per "get-help Connect-NaController -examples", example 4) isn't working. When manually invoking the Get-Credential function, the Connect-NaController process runs just fine. Even allocating a separate $cred variable, and outputting the Get-Credential result works. However, the given syntax from the example throws the following error.

Connect-NaController : Could not connect to x.x.x.x on port 80 for protocol HTTP.

At line:1 char:21

+ Connect-NaController <<<<  x.x.x.x -Credential $cred

    + CategoryInfo          : InvalidResult: (10.20.4.15:NaController) [Connect-NaController], NaConnectionException

    + FullyQualifiedErrorId : HttpConnectionFailed,DataONTAP.PowerShell.SDK.ConnectNaController

Here's the actual script in question:

# Power off NetApp (poweroffnetapp.ps1)

#

# This script is intended to simply shut down a NetApp filer. It is intended

# to run after all other services and systems dependent upon the SAN have

# already halted.

#

# Created By: Ian Young

#

# Variables:  $filers - A comma separate list of filers for this script to

#                                                            execute upon.

#

#

# Usage: ./poweroffnetapp.ps1

#        Intended to be ran in the command section of the APC Powerchute Network

#        Shutdown program before the shutdown sequence has started.

#

#################################################################################

 

Import-Module DataONTAP

 

$user = "root"

$password = ConvertTo-SecureString "password" -AsPlainText -Force

$cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $user,$password

$filer1 = "x.x.x.x"

$filer2 = "x.x.x.x"

   

Write-Host "Shutting down Filer 1"

Connect-NaController $filer1 -Credential $cred

Invoke-NaSsh -Command 'halt -t 0'

 

Write-Host "Shutting down Filer 2"

Connect-NaController $filer2 -Credential $cred

Invoke-NaSsh -Command 'halt -t 0'

It's an absurdly simple script that is meant to run after our SAN-reliant hosts have been shut down. I'm sure I'm missing something completely rudimentary here, but I've never written anything using the DataONTAP Powershell kit, so I'm at a loss. Thanks for any help or advice you can offer!

Who Me Too'd this topic