<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Netapp Powershell Output in ONTAP Discussions</title>
    <link>https://community.netapp.com/t5/ONTAP-Discussions/Netapp-Powershell-Output/m-p/439904#M41489</link>
    <description>&lt;P&gt;Hello Matt&lt;BR /&gt;thank you very much. But also unfortunately with the command:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;$output.results.status = passed&lt;BR /&gt;$output.results.cli-output = empty&lt;/P&gt;&lt;P&gt;$output.results.'cli-result-value' = 0&lt;/P&gt;&lt;P&gt;I connect with my admin user. But are there special rights that I may need?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind Regards&lt;BR /&gt;WhiteBakedBanana&lt;/P&gt;</description>
    <pubDate>Thu, 17 Nov 2022 10:04:29 GMT</pubDate>
    <dc:creator>WhiteBakedBanana</dc:creator>
    <dc:date>2022-11-17T10:04:29Z</dc:date>
    <item>
      <title>Netapp Powershell Output</title>
      <link>https://community.netapp.com/t5/ONTAP-Discussions/Netapp-Powershell-Output/m-p/155674#M35095</link>
      <description>&lt;P&gt;Hi Guys, I need help with Powershell output i am getting.&lt;/P&gt;
&lt;P&gt;I am able to get below output but i need below output to be arranged in format which i can put into CSV.&lt;/P&gt;
&lt;P&gt;Is it possible?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PS D:\OCI\SOE_Compliance\System_Health&amp;gt; Invoke-ncssh -Command "system health subsystem show" | select Value | format-list&lt;BR /&gt;Keyboard-interactive authentication prompts from server:&lt;BR /&gt;End of keyboard-interactive prompts from server&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Value : Subsystem Health&lt;BR /&gt;----------------- ------------------&lt;BR /&gt;SAS-connect ok&lt;BR /&gt;Environment ok&lt;BR /&gt;Memory ok&lt;BR /&gt;Service-Processor ok&lt;BR /&gt;Switch-Health ok&lt;BR /&gt;CIFS-NDO ok&lt;BR /&gt;Motherboard ok&lt;BR /&gt;IO ok&lt;BR /&gt;MetroCluster ok&lt;BR /&gt;MetroCluster_Node ok&lt;BR /&gt;FHM-Switch ok&lt;BR /&gt;FHM-Bridge ok&lt;BR /&gt;SAS-connect_Cluster ok&lt;BR /&gt;13 entries were displayed.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jun 2025 11:12:34 GMT</pubDate>
      <guid>https://community.netapp.com/t5/ONTAP-Discussions/Netapp-Powershell-Output/m-p/155674#M35095</guid>
      <dc:creator>raj_shrivastava11</dc:creator>
      <dc:date>2025-06-04T11:12:34Z</dc:date>
    </item>
    <item>
      <title>Re: Netapp Powershell Output</title>
      <link>https://community.netapp.com/t5/ONTAP-Discussions/Netapp-Powershell-Output/m-p/155683#M35101</link>
      <description>&lt;P&gt;Hi Raj,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would not recommend using "invoke-ncssh". Consider using "invoke-ncsystemapi" instead which enables you to run an SSH command via HTTPS. Here is an example to connect to a cluster, run the system health subsystem show command and format the CLI results using comma delimited output:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Source Code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;Param(
   [Parameter(Mandatory = $True, HelpMessage = "The cluster to show the 'system health subsystem show' command for")]
   [String]$Cluster,
   [Parameter(Mandatory = $True, HelpMessage = "The credentials to connect to the cluster")]
   [System.Management.Automation.PSCredential]$Credentials
)
#'------------------------------------------------------------------------------
Function Format-SystemHealthSubsystem{
   Param(
      [Parameter(Mandatory = $True, HelpMessage = "The CLI output of the 'system health subsystem show' command")]
      [Array]$CLIOutput
   )
   [Array]$results  = @();
   [String]$header  = $($CLIOutput[0] -Replace '(^\s+|\s+$)', '' -Replace '\s+', ' ').ToString().Trim()
   [Array]$results += $header -replace ' ', ','
   For($i=2; ($i -le $CLIOutput.Count - 2); $i++){
      [String]$result  = $($CLIOutput[$i] -Replace '(^\s+|\s+$)', '' -Replace '\s+', ' ').ToString().Trim()
      [Array]$results += $result -replace ' ', ','
   }
   Return $results;
}#End Function
#'------------------------------------------------------------------------------
#'Import the NetApp DataONTAP PowerShell toolkit.
#'------------------------------------------------------------------------------
[String]$moduleName = "DataONTAP"
Try{
   Import-Module -Name $moduleName -ErrorAction Stop
   Write-Host "Imported module ""$moduleName"""
}Catch{
   Write-Warning -Message $("Failed importing module ""$moduleName"". Error " + $_.Exception.Message)
   Break;
}
#'------------------------------------------------------------------------------
#'Connect to the cluster.
#'------------------------------------------------------------------------------
Try{
   Connect-NcController -Name $cluster -HTTPS -Credential $Credentials -ErrorAction Stop | Out-Null
   Write-Host $("Connected to cluster ""$Cluster"" as user " + $Credentials.GetNetworkCredential().UserName)
}Catch{
   Write-Warning -Message $("Failed connecting to cluster ""$Cluster"". Error " + $_.Exception.Message)
   Break;
}
#'------------------------------------------------------------------------------
#'Invoke the SSH command via HTTPS.
#'------------------------------------------------------------------------------
Try{
   $command  = @("system", "health", "subsystem", "show")
   $api      = $("&amp;lt;system-cli&amp;gt;&amp;lt;args&amp;gt;&amp;lt;arg&amp;gt;" + ($command -join "&amp;lt;/arg&amp;gt;&amp;lt;arg&amp;gt;") + "&amp;lt;/arg&amp;gt;&amp;lt;/args&amp;gt;&amp;lt;/system-cli&amp;gt;")
   $output   = Invoke-NcSystemApi -Request $api -ErrorAction Stop
   Write-Host $("Executed Command`: " + $([String]::Join(" ", $command)))
}Catch{
   Write-Warning -Message $("Failed Executing Command`: $command. Error " + $_.Exception.Message)
   Break;
}
If($output.results."cli-result-value" -eq 1){
   [Array]$CLIOutput = $output.results."cli-output".Trim().Split("`n")
   Format-SystemHealthSubsystem -CLIOutput $CLIOutput
}Else{
   Write-Warning -Message $("Failed Executing Command`: " + $([String]::Join(" ", $command)))
   Break;
}
#'------------------------------------------------------------------------------&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Output:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;PS C:\Scripts\PowerShell\Projects\SystemHealthSubSystemShow&amp;gt; $credentials = Get-Credential -Credential admin
PS C:\Scripts\PowerShell\Projects\SystemHealthSubSystemShow&amp;gt; .\SystemHealthSubSystemShow.ps1 -Cluster cluster1.testlab.local -Credentials $credentials
Imported module "DataONTAP"
Connected to cluster "cluster1.testlab.local" as user admin
Executed Command: system health subsystem show
Subsystem,Health
Switch-Health,ok
CIFS-NDO,ok
MetroCluster,ok
MetroCluster_Node,ok
FHM-Switch,ok
FHM-Bridge,ok&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope that helps&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/Matt&lt;/P&gt;</description>
      <pubDate>Thu, 23 Apr 2020 02:38:50 GMT</pubDate>
      <guid>https://community.netapp.com/t5/ONTAP-Discussions/Netapp-Powershell-Output/m-p/155683#M35101</guid>
      <dc:creator>mbeattie</dc:creator>
      <dc:date>2020-04-23T02:38:50Z</dc:date>
    </item>
    <item>
      <title>Re: Netapp Powershell Output</title>
      <link>https://community.netapp.com/t5/ONTAP-Discussions/Netapp-Powershell-Output/m-p/439856#M41471</link>
      <description>&lt;P&gt;Hey matt&lt;/P&gt;&lt;P&gt;I hope you see my comment, because the post is already 2 years old.&lt;BR /&gt;When I run the identical script from you (we have a Netapp Metrocluster) the variable "$output.results" has the "status: Passed" but the variable "cli-result-value" is empty.&lt;/P&gt;&lt;P&gt;Did you have this problem before?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind Regards&lt;/P&gt;&lt;P&gt;WhiteBakedBanana&lt;/P&gt;</description>
      <pubDate>Tue, 15 Nov 2022 13:42:12 GMT</pubDate>
      <guid>https://community.netapp.com/t5/ONTAP-Discussions/Netapp-Powershell-Output/m-p/439856#M41471</guid>
      <dc:creator>WhiteBakedBanana</dc:creator>
      <dc:date>2022-11-15T13:42:12Z</dc:date>
    </item>
    <item>
      <title>Re: Netapp Powershell Output</title>
      <link>https://community.netapp.com/t5/ONTAP-Discussions/Netapp-Powershell-Output/m-p/439894#M41486</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've not seen that before. Does it work if you change the command? Does it give you any output if you change the command to:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;$command  = @("version")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That should display the ONTAP system version in the value of "$output.results" EG:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;PS C:\Scripts\PowerShell\Projects\InvokeCommand&amp;gt; .\InvokeCommand.ps1 -Cluster cluster1.testlab.local -Credentials $credential
Imported module "DataONTAP"
Connected to cluster "cluster1.testlab.local" as user admin
Executed Command: version
NetApp,Release,9.11.1:,Tue,Jul,12,04:38:28,UTC,2022&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/Matt&lt;/P&gt;</description>
      <pubDate>Thu, 17 Nov 2022 01:19:32 GMT</pubDate>
      <guid>https://community.netapp.com/t5/ONTAP-Discussions/Netapp-Powershell-Output/m-p/439894#M41486</guid>
      <dc:creator>mbeattie</dc:creator>
      <dc:date>2022-11-17T01:19:32Z</dc:date>
    </item>
    <item>
      <title>Re: Netapp Powershell Output</title>
      <link>https://community.netapp.com/t5/ONTAP-Discussions/Netapp-Powershell-Output/m-p/439904#M41489</link>
      <description>&lt;P&gt;Hello Matt&lt;BR /&gt;thank you very much. But also unfortunately with the command:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;$output.results.status = passed&lt;BR /&gt;$output.results.cli-output = empty&lt;/P&gt;&lt;P&gt;$output.results.'cli-result-value' = 0&lt;/P&gt;&lt;P&gt;I connect with my admin user. But are there special rights that I may need?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind Regards&lt;BR /&gt;WhiteBakedBanana&lt;/P&gt;</description>
      <pubDate>Thu, 17 Nov 2022 10:04:29 GMT</pubDate>
      <guid>https://community.netapp.com/t5/ONTAP-Discussions/Netapp-Powershell-Output/m-p/439904#M41489</guid>
      <dc:creator>WhiteBakedBanana</dc:creator>
      <dc:date>2022-11-17T10:04:29Z</dc:date>
    </item>
    <item>
      <title>Re: Netapp Powershell Output</title>
      <link>https://community.netapp.com/t5/ONTAP-Discussions/Netapp-Powershell-Output/m-p/439937#M41490</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When you say "admin" user, are you referring to the builtin admin user or another administrative account. What's the output of the following command for the user that you are using?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;cluster1::&amp;gt; login show -user-or-group-name admin
  (security login show)

Vserver: cluster1
                                                                 Second
User/Group                 Authentication                 Acct   Authentication
Name           Application Method        Role Name        Locked Method
-------------- ----------- ------------- ---------------- ------ --------------
admin          amqp        password      admin            no     none
admin          console     password      admin            no     none
admin          http        password      admin            no     none
admin          ontapi      password      admin            no     none
admin          service-processor
                           password      admin            no     none
admin          ssh         password      admin            no     none
6 entries were displayed.&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;/Matt&lt;/P&gt;</description>
      <pubDate>Fri, 18 Nov 2022 00:09:43 GMT</pubDate>
      <guid>https://community.netapp.com/t5/ONTAP-Discussions/Netapp-Powershell-Output/m-p/439937#M41490</guid>
      <dc:creator>mbeattie</dc:creator>
      <dc:date>2022-11-18T00:09:43Z</dc:date>
    </item>
  </channel>
</rss>

