PowerShell Scripts with WhatIf
Sometimes you want to simulate the execution of a PowerShell script. Instead of actually doing the things defined in the script you just want to see what would have been done. Many Cmdlets understand the parameter -WhatIf. If you use it e.g. when creating a directory it actually will not be created. Instead you get a message describing what would have been done:
|
|
PS C:\> New-Item -ItemType Directory -Name "test" -Path "c:\temp" -WhatIf What if: Performing the operation "Create Directory" on target "Destination: C:\temp\test".