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
The following commands require that a user confirm the operation before continuing...
Invoke-NaSnapmirrorRelease
Invoke-NaSnapmirrorBreak
Remove-NaSnapshot
I would like to be able to answer "yes" programmatically for these commands so the user is not prompted for each item. Is that possible?
I see that each of these cmdlets have a -Confirm switch, but they seem to behave the same weather the switch is set or not.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, the simplest way to do this is to use the $confirmpreference environment variable. To turn off prompts completely, add the following to the top of your script:
$confirmpreference = "none"
Alex
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can also disable prompts on a per-cmdlet basis by specifying -Confirm:$false.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the great suggestions. I tried using -Confirm $false, but that didn't work...I was missing the colon syntax, -Confirm:$false works great.
I'm curious why that option defaults to $true? I understand the reasoning from an administrative perspective...those are dangerous commands. From from a programming perspective, if the default is $true, maybe there should be -NoConfirm switch to change it to false?
Thanks again for the help!
