February 2013
Intermediate to advanced
304 pages
8h 26m
English
Scenario/Problem: You need to automatically confirm operations such that a script runs unattended.
Solution: Include the -Confirm parameter with a $false setting.
When running cmdlets discussed in this book, you might receive a confirmation message to confirm the action being processed. If you use these cmdlets in scripts, the script will not run straight through without prompting for the confirmation.
The cmdlets that have a -Confirm optional parameter can be called in unattended mode by passing in -Confirm:$false to the cmdlet, as shown in Listing 2.3.
Listing 2.3. Suppressing the Confirmation Prompt Example
Remove-item *.png -Confirm:$false
Note
Not all cmdlets have a –Confirm parameter. Use the help ...
Read now
Unlock full access