Skip to content

Expand-Archive -Verbose:$false results in a verbose print that doesn't happen when -Verbose` is not passed at all #98

@MatejKafka

Description

@MatejKafka

Copied from PowerShell/PowerShell#14245.

Steps to reproduce

$VerbosePreference = 'Ignore'
ni test.txt
Compress-Archive test.txt archive.zip

# this will be silent
echo 'expand without -Verbose'
Expand-Archive archive.zip outputDir

rm outputDir

# this will print multiple lines of verbose output
echo 'expand with-Verbose:$true'
Expand-Archive archive.zip outputDir -Verbose:$true

rm outputDir

# this will for some reason output a single verbose line, although it should be silent:
# VERBOSE: Performing the operation "Create Directory" on target "Destination: ...".
echo 'expand with -Verbose:$false'
Expand-Archive archive.zip outputDir -Verbose:$false

Expected behavior

-Verbose:$false should either behave the same as when -Verbose is not passed at all, or suppress all verbose output.

expand without -Verbose
expand with-Verbose:$true
VERBOSE: Performing the operation "Create Directory" on target "Destination: D:\test\outputDir".
VERBOSE: Preparing to expand...
VERBOSE: Performing the operation "Expand-Archive" on target "D:\test\archive.zip".
VERBOSE: Created 'D:\test\outputDir\test.txt'.
expand with -Verbose:$false

Actual behavior

-Verbose:$false causes unexpected verbose output.

expand without -Verbose
expand with-Verbose:$true
VERBOSE: Performing the operation "Create Directory" on target "Destination: D:\test\outputDir".
VERBOSE: Preparing to expand...
VERBOSE: Performing the operation "Expand-Archive" on target "D:\test\archive.zip".
VERBOSE: Created 'D:\test\outputDir\test.txt'.
expand with -Verbose:$false
VERBOSE: Performing the operation "Create Directory" on target "Destination: D:\test\outputDir".

Environment data

Name                           Value
----                           -----
PSVersion                      7.2.0-preview.1
PSEdition                      Core
GitCommitId                    7.2.0-preview.1
OS                             Microsoft Windows 10.0.19041
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions