Microsoft Virtualization Discussions
Microsoft Virtualization Discussions
Hi,
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:
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?
Thanks,
Corey
Solved! See The Solution
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
Regards,
Ed.
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
Regards,
Ed.
Fantastic! That worked a charm.
Thanks heaps Ed
I do understand the dangers of this, but it is handy to know.
Cheers.
Hi,
Whe I use
Set-NaVol $VOL -offline | Remove-NaVol -Confirm:$False -Whatif
before:
Temper | online | 80,0 GB | 0% | 80,0 GB True | 103 | 3M aggr3 |
after:
Temper | offline | 0 | 0% | 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 ?
^^
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