Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello all, Need some help. I want to run the following:
volume snapshot show -fields create-time, size, state, is-constituent
Using the Ontap Powershell and redirect it to a local Excel format. I can get connected to my Clusters using the Connect-NcController, just cannot get the syntax correct for the volume command.
Any help would be great.
Solved! See The Solution
1 ACCEPTED SOLUTION
Drew_C has accepted the solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try to look up in our forum, you might find lots of examples.
This command should return the size, created time but not sure about state, is-constituent.
Get-NcSnapshot
Check this thread:
https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Powershell-command-to-list-snapshot-details-for-particular-volumes/m-p/108689
Following command will give more output, check it out yourself.
Get-NcSnapshot | ?{ $_.Created}
Get-NcSnapshot | ?{ $_.Created} | Export-Csv snapshot.csv
Note: File will get saved in your c:/drive.
2 REPLIES 2
Drew_C has accepted the solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try to look up in our forum, you might find lots of examples.
This command should return the size, created time but not sure about state, is-constituent.
Get-NcSnapshot
Check this thread:
https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Powershell-command-to-list-snapshot-details-for-particular-volumes/m-p/108689
Following command will give more output, check it out yourself.
Get-NcSnapshot | ?{ $_.Created}
Get-NcSnapshot | ?{ $_.Created} | Export-Csv snapshot.csv
Note: File will get saved in your c:/drive.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 "
