General Discussion

Powershell command to list disks for an aggregate

PerhapsCloud
1,782 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
1,690 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
1,729 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
1,715 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
1,691 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
1,697 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