Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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:
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?
Thanks,
Corey
Solved! See The Solution
1 ACCEPTED SOLUTION
migration has accepted the solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
4 REPLIES 4
migration has accepted the solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Fantastic! That worked a charm.
Thanks heaps Ed
I do understand the dangers of this, but it is handy to know.
Cheers.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
^^
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
