Microsoft Virtualization Discussions

Getting read only Volume

JGPSHNTAP
4,196 Views

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}

1 ACCEPTED SOLUTION

timothyn
4,196 Views

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

View solution in original post

2 REPLIES 2

timothyn
4,197 Views

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

JGPSHNTAP
4,196 Views

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

Public