Subscribe
Accepted Solution

Set-NaVolOption

hi Guys,

would this work:

+++++++++++++++++++

$vols = Get-Content c:\volumes.txt

Foreach ($vol in $vols)

{

Get-NaVol –Name $vol | Get-NaVolOption | ? {$_. fractional_reserve -ne 0} | Set-NaVolOption -Key fractional_reserve –Value 0

}

+++++++++++++++++

Thank you

Re: Set-NaVolOption

That will not work.  Fractional_reserve is part of the name property.

Also, why are you dumping volumes from a file?  

I don't see you connecting to a controller either.. How you are planning on executing this,  That will determine how we can assist.

For example, what I would do

$hosts = gc c:\temp\filers.txt # list of filers

$hosts | % {

$Filer = $_

$c = connect-nacontroller $filer

$vols = Get-navol

$vols | % {

$volume = $_.name

if ((get-navoloption $volume | ? {$_.name -eq "fractional_reserve"}).value -ne 0)

{ set-navoloption $volume fractional_reserve 0

          }

     }

}

Re: Set-NaVolOption

"why are you dumping volumes from a file? " - I've been asked to do a list of volumes

"I don't see you connecting to a controller either" - I would have used the 'connect-nacontroller' obviously. I did not forget that

thanks for the rest of the script = I'll try that

Let me know if you want to add anything

thank you

Re: Set-NaVolOption

would this work?

++++++++++++++++++++++++++

$vols = Get-Content c:\volumes.txt

Foreach ($vol in $vols)

{

if ((get-navoloption $vol | ? {$_.name -eq "fractional_reserve"}).value -ne 0)

{ set-navoloption $volume fractional_reserve 0}

}

+++++++++++++++++++++++

Re: Set-NaVolOption

I would also like to save a report of what exactly was done - something like a combination of -Verbose and Start-Transcript

is that possible?

thank you

Re: Set-NaVolOption

Your updated script will not work.

Change $volume to $vol

I didn't test it all but in theory it should work fine. 

Re: Set-NaVolOption

it worked - thanks