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
I figured this one would be fairly simple and I reviewed the help for both get-navol and get-navoloption but i'm not able to find exactly what I was looking for.
I'm basically looping through our environment removing old snaps based on a criteria set but some filers have both source and snapmirrored (r/o) volumes. I was hoping there was an option in get-navol for read ony but i didn't see it anywhere
Am I just overlooking this?
Here's my basic code
$45day = Get-NaVol | where {$_.state -eq "online" }`
| Get-NaSnapshot | where {((get-date)-$_.created).days -gt 46}
Solved! See The Solution
1 ACCEPTED SOLUTION
migration has accepted the solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You'll have to look at the RaidStatus property, which contains more than just the read-only flag. So you can use "-match" or "-notmatch" like this:
PS C:\> get-navol | ? {$_.RaidStatus -match "read-only"} | ft Name, State, RaidStatus
Name State RaidStatus
---- ----- ----------
rre1deleteme online raid_dp,snapmirrored,read-only
rresql online raid_dp,snapmirrored,read-only
Cheers!
Eric
2 REPLIES 2
migration has accepted the solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You'll have to look at the RaidStatus property, which contains more than just the read-only flag. So you can use "-match" or "-notmatch" like this:
PS C:\> get-navol | ? {$_.RaidStatus -match "read-only"} | ft Name, State, RaidStatus
Name State RaidStatus
---- ----- ----------
rre1deleteme online raid_dp,snapmirrored,read-only
rresql online raid_dp,snapmirrored,read-only
Cheers!
Eric
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Eric,
Thanks for the quick response.. I was "assuming" this would be a Boolean property under get-navol.
I have updated my code and am testing it now..
$45day = Get-NaVol | where {$_.state -eq "online" -and $_.raidstatus -notmatch "read-only"}`
| Get-NaSnapshot | where {((get-date)-$_.created).days -gt 46}
Next I will be piping it to | remove-nasnapshot -confirm:$false
