hi
Once you have successfully connected to the cluster using Connect-NcController, you can easily get the information you want by running the following script
script
# Get all snapshot information and convert the Total field to legible units
$snapshots = Get-NcSnapshot | Select-Object Name, Volume, Created, Total
#Function: Converts bytes into legible units
function Convert-Bytes {
param([long]$bytes)
if ($bytes -lt 1KB) {
return "{0} B" -f $bytes
}
elseif ($bytes -lt 1MB) {
return "{0:N2} KB" -f ($bytes / 1KB)
}
elseif ($bytes -lt 1GB) {
return "{0:N2} MB" -f ($bytes / 1MB)
}
elseif ($bytes -lt 1TB) {
return "{0:N2} GB" -f ($bytes / 1GB)
}
else {
return "{0:N2} TB" -f ($bytes / 1TB)
}
}
# Change the unit of the Total field
$snapshots | ForEach-Object {
$_ | Add-Member -MemberType NoteProperty -Name "Total " -Value (Convert-Bytes $_.Total) -Force
$_
} | Select-Object Name, Volume, Created, "Total "