Microsoft Virtualization Discussions
Microsoft Virtualization Discussions
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
Solved! See The Solution
Your updated script will not work.
Change $volume to $vol
I didn't test it all but in theory it should work fine.
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
}
}
}
"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
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}
}
+++++++++++++++++++++++
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
Your updated script will not work.
Change $volume to $vol
I didn't test it all but in theory it should work fine.
it worked - thanks