NetApp Community Update
This site will enter Read Only mode on July 23 as we prepare to move to a new platform. You will still be able to view content, but posting and replying will be temporarily disabled.
We're excited to launch our new Community experience on July 30 and more information will follow soon.
Stay connected during the transition - Join our Discord community today.

General Discussion

Powershell command to list disks for an aggregate

PerhapsCloud
4,484 Views

Does anybody know here a powershell command to list all the disks in an aggregate? ( disks could be partitioned or non-partitioned). I haven't been able to find such a command other than using a 7-mode command "aggr show -r". Thanks.

1 ACCEPTED SOLUTION

mbeattie
4,392 Views

Hi,

You could try the invoke-ncsystemapi cmdlet with the command mentioned by @Ontapforrum 

Something like this:

[Array]$command = @("set diag;storage", "disk", "partition", "show")
Try{
   $api = $("<system-cli><args><arg>" + ($command -join "</arg><arg>") + "</arg></args></system-cli>")
   Write-Host $("Executed Command`: " + $([String]::Join(" ", $command)))
   $response = Invoke-NcSystemApi -Request $api -ErrorAction Stop
}Catch{
   Write-Warning -Message $("Failed Executing Command`: " + $([String]::Join(" ", $command))
   Break;
}
$response.results."cli-output"

/Matt

If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.

View solution in original post

4 REPLIES 4

Ontapforrum
4,429 Views

PS C:\> Get-NcDisk

 

There are few more get-ncdisk* commands on page-31: (give it a try)
https://www.netapp.com/pdf.html?item=/media/16861-tr-4475pdf.pdf

 

PerhapsCloud
4,415 Views

Thank you so much.

This command lists disks and their aggrs if the disks aren't partitioned. The aggr field is bland when disks are partitioned/shared. How to list those disks with aggr information in Powershell? Thanks.

mbeattie
4,393 Views

Hi,

You could try the invoke-ncsystemapi cmdlet with the command mentioned by @Ontapforrum 

Something like this:

[Array]$command = @("set diag;storage", "disk", "partition", "show")
Try{
   $api = $("<system-cli><args><arg>" + ($command -join "</arg><arg>") + "</arg></args></system-cli>")
   Write-Host $("Executed Command`: " + $([String]::Join(" ", $command)))
   $response = Invoke-NcSystemApi -Request $api -ErrorAction Stop
}Catch{
   Write-Warning -Message $("Failed Executing Command`: " + $([String]::Join(" ", $command))
   Break;
}
$response.results."cli-output"

/Matt

If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.

Ontapforrum
4,397 Views

I don't know how to get that info via PS, but if you just need that info, you can get it directly from Ontap CLI from diag mode.

::>set diag
::*> storage disk partition show

Public