none
HP Smart Array Health check script RRS feed

  • Question

  • I'm tring to run a script to pull information from a HP RAID Array controller, but I get one of these 2 erros bellow.

    Error 1; 

    cmdlet Get-HPESAConfigurationStatus at command pipeline position 1
    Supply values for the following parameters:
    Connection[0]:

    Script 1;

    Invoke-Command -ComputerName 192.168.0.150 -Credential administrator {Get-HPESAConfigurationStatus}

    error 2;

    Connection cannot be eastablished to the server

    Script;

    #Command line parameters
    Param{
        # IP(s) or Hostname(s).If multiple addresses separated by comma (,)
        $Address = '192.168.0.150'
        #In case of multiple servers it use same credential for all the servers
        $Credential = "user"
        $Password = "password"
        }
    #Check for server avaibiality
    function CheckServerAvailability ($ListOfAddress)
    {
        [int]$pingFailureCount = 0
        [array]$PingedServerList = @()
        foreach($serverAddress in $ListOfAddress)
        {
               if(Test-Connection $serverAddress)
               {
                #Write-Host "Server $serverAddress pinged successfully."
                $PingedServerList += $serverAddress
               }
               else
               {
                Write-Host "`nServer $serverAddress is not reachable. Please check network connectivity"
                $pingFailureCount ++
               }
        }
        if($pingFailureCount -eq $ListOfAddress.Count)
        {
            Write-Host "`nServer(s) are not reachable please check network connectivity"
            exit
        }
        return $PingedServerList
    }

    #clear host
    Clear-Host
    # script execution started
    Write-Host "`n****** Script execution started ******" -ForegroundColor Yellow
    Write-Host "`nThis script gets smart array controller details."
    #dont show error in script
    #$ErrorActionPreference = "Stop"
    #$ErrorActionPreference = "Continue"
    #$ErrorActionPreference = "Inquire"
    $ErrorActionPreference = "SilentlyContinue"
    #check PowerShell support
    $PowerShellVersion = $PSVersionTable.PSVersion.Major
    if($PowerShellVersion -ge "3")
    {
        Write-Host "`nYour PowerShell version : $($PSVersionTable.PSVersion) is valid to execute this script"
    }
    else{
        Write-Host "`nThis script required PowerSehll 3 or above.
                    `nCurrent installed PowerShell version is $($PSVersionTable.PSVersion)"
        Write-Host "`nPlease Update PowerShell version"
        Write-Host "`nExit..."
        exit
    }
    #Check HPESmartArrayCmdlets module is installed or not.
    $HPESmartArrayCmdlets = "HPESmartArrayCmdlets"
    $InstalledModule = Get-Module
    $ModuleNames = $InstalledModule.Name
    if(-not($ModuleNames -like $HPESmartArrayCmdlets))
    {
        Write-Host "Loading module :  $HPESmartArrayCmdlets"
        Import-Module $HPESmartArrayCmdlets
        if(($(Get-Module -Name $HPESmartArrayCmdlets)  -eq $null))
        {
            Write-Host "`n$HPESmartArrayCmdlets module cannot be loaded. Please fix the problem and try again"
            Write-Host "`nExit..."
            exit
        }
    }
    else
    {
        $InstalledSAModule  =  Get-Module -Name $HPESmartArrayCmdlets
        Write-Host "$HPESmartArrayCmdlets Module Version : $($InstalledSAModule.Version) is installed on your machine."
        Write-host ""
    }
    #check for IP(s) or Hostname(s) Input. if not available prompt for Input
    if($Address.Count -eq 0)
    {
        $tempAddress = Read-Host "Enter server address (IPv4/IPv6 or Hostname). Multiple entries separated by comma (,)"
        $Address = ($tempAddress.Trim().Split(','))
    if($Address.Count -eq 0)
    {
        Write-Host "`nYou have not entered IP(s) or Hostname(s)"
        Write-Host "`nExit..."
        exit
    }
    if($Credential -eq $null)
    {
        $Credential = Get-Credential -Message "Enter Username and Password (Use same credential for multiple servers)"
        Write-Host ""
    }
    #Ping and test IP(s) or Hostname(s) are reachable or not
    $ListOfAddress =  CheckServerAvailability($Address)
    #create connection object
    [array]$ListOfConnection = @()
    foreach($IPAddress in $ListOfAddress)
    {
        Write-Host "`nConnecting to server  : $IPAddress"
        $connection = Connect-HPESA -IP $IPAddress -Credential $Credential -WarningAction SilentlyContinue
       
        #Retry connection if it is failed because  of invalid certificate with -DisableCertificateAuthentication switch parameter
        if($Error[0] -match "The underlying connection was closed"){
           $connection = Connect-HPESA -IP $IPAddress -Credential $Credential -DisableCertificateAuthentication -WarningAction SilentlyContinue
        }
        elseif($Error[0] -match "Smart Array Cmdlets are not supported on ProLiant"){
           Write-Host $($Error[0].Exception.Message) -ForegroundColor Red
           Exit
        }
        if($connection -ne $null){ 
            Write-Host "`nConnection established to the server $IPAddress" -ForegroundColor Green
            $connection
            $ListOfConnection += $connection
        }
        else{
            Write-Host "Connection cannot be eastablished to the server : $IPAddress" -ForegroundColor Red
        }
    }
    if($ListOfConnection.Count -eq 0){
        Write-Host "`nExit..."
        exit
    }
    #Get smart array controller details
    foreach($serverConnection in $ListOfConnection)
    {
        $result = Get-HPESADiscoveryStatus -Connection $serverConnection
        $find = Find-HPESA -Connection $serverConnection
        Write-Host "------------------------ Server $($serverConnection.IP) -----------------------------`n" -ForegroundColor Yellow
        $result
        $find.SmartArrayController
    }

    Disconnect-HPESA -Connection $ListOfConnection
    $ErrorActionPreference = "Continue"
    Write-Host "****** Script execution completed ******" -ForegroundColor Yellow
    exit

    I'm new to PS so any help is appreciated. 

    thanks,


    • Edited by Tablaty2 Monday, June 10, 2019 4:13 PM
    Monday, June 10, 2019 4:13 PM

All replies

  • You cannot run that command remotely.


    \_(ツ)_/

    Monday, June 10, 2019 4:46 PM
  • Got it, any idea why I'm still getting this message when I run any scripts locally? 

    cmdlet Find-HPESA at command pipeline position 1
    Supply values for the following parameters:

    Connection[0]: 


    Wednesday, June 12, 2019 1:43 PM
  • Yes.  You need to supply a connection parameter.  Contact HP for help with this.


    \_(ツ)_/

    Wednesday, June 12, 2019 1:52 PM