Closed
Description
Steps to reproduce
function TestCompress() {
[CmdLetBinding(SupportsShouldProcess=$true)]
param (
[string]$source,
[string]$dest
)
PROCESS {
Compress-Archive -Path $source -DestinationPath $dest
}
}
Call with TestCompress -source testfile -dest $env:temp\testfile.zip -WhatIf
Expected behavior
Output should be:
What if: Performing the operation "Compress-Archive" on target ...\testfile.zip
No zip file archive should be created.
Actual behavior
Zip file archive is created in destination directory.
Notes
The -WhatIf parameter is passed through if Compress-Archive is replaced by Copy-Item in the function above.
Calling Compress-Archive with -WhatIf directly yields the correct results.