Effective December 3, NetApp adopts Microsoft’s Business-to-Customer (B2C) identity management to simplify and provide secure access to NetApp resources.
For accounts that did not pre-register (prior to Dec 3), access to your NetApp data may take up to 1 hour as your legacy NSS ID is synchronized to the new B2C identity.
To learn more, read the FAQ and watch the video.
Need assistance? Complete this form and select “Registration Issue” as the Feedback Category.

Legacy Product Discussions

Please help in writing a Powershell script to delete all backups from a server



I am fairly new to the whole powershell/netapp domain.

The idea is to list the available backups on the server and then delete all of them for we use cloning to get the most recent snapshots of SQL databases. There is simply no need to older data. As far as I understand, the loop will go through each component of the get-backup array and try to delete it, failing on one will result going to the next, and that is what we are looking for.

So I was trying something like:

get-backup -server ourserver -serverinstance -ourserverinstance; delete-backup

I get the following:

cmdlet delete-backup at command pipeline position 1

Supply values for the following parameters:



How do I do wild cards here? Thanks



I finally figured it out. The script is below. First, we have to download, install and load the Data ONTAP Powershell Toolkit (http://communities.netapp.com/docs/DOC-8111?REF_SOURCE=tot-1010&h).

Next, create a function to connect to a na controller and delete all snaps which are not busy. You would need an admin-level account and password. Last, execute the function against related volumes.

--defining function

function nas
{param ($vol)
$User  = "admin-level account"
$Pass  = ConvertTo-SecureString "pass for the account" -AsPlainText –Force
$cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $User,$Pass
Connect-NaController -Name "name of controller" -credential $cred | out-null
$delete = Get-NaSnapshot -Name $vol
if ($delete -ne $null){
foreach($snap in $delete){
Write-Output $volname $snap.Name
Remove-NaSnapshot -Volume $vol -SnapName $snap.Name -Confirm:$false}}}

--executing function (you can get case-sensitive volume names by checking DATA Ontap Management Tool->FilerView)

nas volume1

nas volume 2

nas volume 3


NetApp on Discord Image

We're on Discord, are you?

Live Chat, Watch Parties, and More!

Explore Banner

Meet Explore, NetApp’s digital sales platform

Engage digitally throughout the sales process, from product discovery to configuration, and handle all your post-purchase needs.

NetApp Insights to Action
I2A Banner