O'Reilly logo

Microsoft® SQL Server 2012 Unleashed by Alex T. Silverstein, Chris Gallelli, Paul T. Bertucci, Ray Rankins

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

-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:

PS>New-Item -Type File -Path file.tmp    Directory: Microsoft.PowerShell.Core\FileSystem::C:\bookMode                LastWriteTime     Length Name----                --------------     ------ -----a---          8/4/2008  10:33 PM          0 file.tmpPS>Remove-Item -Path file.tmp -WhatIfWhat if: Performing operation "Remove File" on Target"C:\book\file.tmp".PS>

Two new cmdlets are demonstrated in the preceding example: New-Item ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required