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
Created object on get-NaSnapsot Powershell 4.1 dissapeared
2016-01-30
01:06 PM
4,238 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi!
I have one Powershell code to delete old snapshots: Get-Navol | Get-NaSnapshot | where-object {$_.name -like "smo_*" -and $_.created -lt $3days} | Remove-NaSnapshot -Confirm
My storage is FAS8020 7-mode 8.2.2P2 and after upgrade the powershell toolkit to version 4.1 de .created object was dissapear.
Who can I do the same with the new version of Powershell or where can I download the old version of toolkit?
Best regards
4 REPLIES 4
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can you give any more details?
- Does "Get-NaVol" return all expected volumes?
- Does "Get-NaVol | Get-NaSnapshot" return all expected snapshots?
- Does the filter for '$_.Name -like "smo_*"' return the exected values?
- Does the filter for '$_.Created -lt $3days' return the expected values?
- What is the value of "$3days"?
In particular, for the last two it would be helpful to know if they work separately...i.e. just use one at a time for the testing.
Andrew
If this post resolved your issue, please help others by selecting ACCEPT AS SOLUTION or adding a KUDO.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is the complete script
#Variable of date type which is 3 days before the current date
$3days = (get-date).adddays(-3)
#Get list of all snapshots older than 3 days and delete them
Get-Navol | Get-NaSnapshot | where-object {$_.name -like "smo_*" -and $_.created -lt $3days} | Remove-NaSnapshot -Confirm
It was working properly until the upgrade.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Could you also tell us which version of Data ONTAP PowerShell Toolkit you were using before this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I tried with the same scenario and was able to achieve the deletion of snapshots. I have tried with just 1 day earlier snapshots, as I dont have very old snapshots. Below are the images for reference.
#Variable of date type which is 1 day before the current date
$1day = (get-date).adddays(-1)
As seen in the images, the snapshots were deleted successfully.
