Video Screencast Help

Save without confirmation

Created: 28 Jan 2013 • Updated: 16 Mar 2013 | 1 comment
This issue has been solved. See solution.

Hi

At the end of a bemcli script I have got Save-BEBackupDefinition.

Now I would like to run the script without the need to confirm the save action. I tried with the -Confirm switch without success.

Should it be

Save-BEBackupDefinition -Confirm True

or

Save-BEBackupDefinition -Confirm False

I have found examples with -Confirm:$False which also does not work in my script. Why a : ?

Get-Help Save-BEBackupDefinition does not explain the -Confirm switch.

 

Thank you

Stefan

Comments 1 CommentJump to latest comment

pkh's picture

The correct way to code the parameter is -Confirm:$False.  Why did you say that this does not work?

The confirm switch is part of Powershell and not a special parameter created in the BEMCLI cmdlet.  That is why the cmdlet does not need to explain its usage.

As to why the colon, confirm itself is a switch and its value needs to be tested.  See this for a fuller explanation.

http://stackoverflow.com/questions/8525572/powersh...

 

P.S. I find it easier to debug a script if I step through each command separately before I put them together in a script.  This way, I am sure that I got the syntax right for each command.

SOLUTION