-WhatIf/-Confirm Parameters

Several of the core PowerShell cmdlets support –whatif and/or –confirm parameters. The cmdlets that support these parameters could actually make system changes that cannot be reserved, such as deleting a file.

Consider the following example using these parameters:

image

Two new cmdlets are demonstrated in the preceding example: New-Item, used to create things such as files, and Remove-Item, used to delete or remove things such as files.

Get Microsoft® SQL Server 2008 R2 Unleashed 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.