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.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access