8.1. Look Before You Leap

The whatif, confirm, and verbose parameters are available on many, but not all, Windows PowerShell cmdlets. Strictly speaking only the whatif and confirm parameters give you the information you would like before you leap. The verbose parameter tells you that you have leapt and exactly what you hit on the way down! Sometimes that after-the-event information you get from the -verbose parameter will be all you need. If that isn't enough, then you probably need to use the whatif or confirm parameters.

The cmdlets that are potentially most dangerous are those that use the remove verb. There are five such cmdlets:

  • remove-drive

  • remove-item

  • remove-pssnapin

  • remove-property

  • remove-variable

In later sections in this chapter, I demonstrate how you can use the -whatif and -confirm parameters with some of the preceding cmdlets.

Get Professional Windows® PowerShell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.