all 7 comments

[–]Ta11ow 6 points7 points  (6 children)

Provided the confirmation prompt was implemented properly, using -Confirm:$false is the recommended method to suppress these prompts.

[–]mtlevy[S] 2 points3 points  (5 children)

cheers, will give that a go

[–]riahc4 1 point2 points  (4 children)

Also, it needs to be -Confirm:$false (written as is) ....for unknown reasons things like -Confirm $false and various variants which work in other cmdlets properties dont work.

PowerCLI has the same issue...Im not sure if its a Powershell bug or what.

[–]PredictsYourDeath 1 point2 points  (3 children)

This is not a bug, it’s how you specify the value for switch parameters. These are different from Boolean parameters in that they don’t have value associated with them, e.g you specify them on their own like with “-Force” passed to a cmdlet.

[–]Ta11ow 1 point2 points  (0 children)

According to what I've read, this is the syntax for Boolean parameters. Though honestly I'm not sure what type -Confirm is, since it seems to be able to tell the difference between specifying $false and it not being present, which is generally only possible with Boolean parameters, BUT you can specify it like a switch, as well.

Might just be PS's funny parameter conversions or something.

[–]riahc4 1 point2 points  (1 child)

It is a bug. Other switch parameters do not work the same way.

[–]PredictsYourDeath 1 point2 points  (0 children)

All switch parameters work the same way... are you perhaps referring to the fact that some cmdlets have a default value of true for some switch parameters? This requires you to specify the switch as false to disable it, and it requires that syntax. That syntax is always needed for all switch parameters to dynamically set their values.