Microsoft Virtualization Discussions

Getting read only Volume


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}


Re: Getting read only Volume


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   



View solution in original post

Re: Getting read only Volume



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

Earn Rewards for Your Review!
GPI Review Banner
All Community Forums