Accepted Solution

remove-navol help


In my script I want to remove a list of volumes, and I want to do so without it prompting me with the "Are you sure you want to destroy..." message.

Here's the section of the script I am referring to:

foreach ($VOL in $vol_list)
Set-NaVol $VOL -offline | Remove-NaVol

However when I run this it prompts with the "Are you sure you want to destroy volume ..." and you need to answer "Y" or hit enter to continue, and again for every volume in the list.  How can I force this to just happen without user intervention?


Re: remove-navol help

You can simply append -Confirm:$false to your Remove-NaVol command like so;

Set-NaVol $VOL -offline | Remove-NaVol -Confirm:$False

Obviously you want to be careful once that's in place as you won't get a second chance. You can test what would happen by using -WhatIf like so;

Set-NaVol $VOL -offline | Remove-NaVol -Confirm:$False -Whatif



Re: remove-navol help

Fantastic!  That worked a charm.

Thanks heaps Ed

I do understand the dangers of this, but it is handy to know.


Re: remove-navol help


Whe I use

Set-NaVol $VOL -offline | Remove-NaVol -Confirm:$False -Whatif


Temper                online    80,0 GB0%80,0 GB  True     103     3M aggr3


Temper                offline         00%      0 False       0      0 aggr3

Volume is not removed, only Offline state and information is 0.

When I use without -Confirm:$False -Whatif, VOL is removed OK.

Any Idea ?

Re: remove-navol help


Confused.. Do you know what -whatif does?

The command doesn't execute if you specify -whatif

The command should work fine with - Remove-NaVol -Confirm:$False