New-FileCatalog ignores -WhatIf · Issue #2866 · PowerShell/PowerShell · GitHub
Skip to content

New-FileCatalog ignores -WhatIf #2866

@PatrickFB

Description

@PatrickFB

Steps to reproduce

C:\PS> Get-Date > Date.tmp
C:\PS> New-FileCatalog -CatalogVersion 2 -CatalogFilePath catalog.cat -Path Date.tmp -WhatIf

Expected behavior

What if: Performing the operation "Create new file catalog" on target "C:\PS\catalog.cat".

Actual behavior

Mode          LastWriteTime Length Name       
----          ------------- ------ ----       
-a----  12/9/2016  12:37 PM    433 catalog.cat

You can see the file has been created.
The Hash is also being calculated too.

C:\PS> Test-FileCatalog -Detailed -CatalogFilePath catalog.cat 

Status        : Valid
HashAlgorithm : SHA256
CatalogItems  : {[Date.tmp, 2F38E0FD77AF90E6E463938C4D4ED9AE03F575AC7C0441C6A3DBE9A1C4D55459]}
PathItems     : {[Date.tmp, 2F38E0FD77AF90E6E463938C4D4ED9AE03F575AC7C0441C6A3DBE9A1C4D55459]}
Signature     : System.Management.Automation.Signature

C:\PS> Get-FileHash -Path Date.tmp

Algorithm : SHA256
Hash      : 2F38E0FD77AF90E6E463938C4D4ED9AE03F575AC7C0441C6A3DBE9A1C4D55459
Path      : C:\Temp\Demo\Date.tmp

Environment data

> $PSVersionTable

Name                      Value                  
----                      -----                  
PSVersion                 5.1.14393.206          
PSEdition                 Desktop                
PSCompatibleVersions      {1.0, 2.0, 3.0, 4.0...}
BuildVersion              10.0.14393.206         
CLRVersion                4.0.30319.42000        
WSManStackVersion         3.0                    
PSRemotingProtocolVersion 2.3                    
SerializationVersion      1.1.0.1                

Metadata

Metadata

Assignees

No one assigned

    Labels

    HacktoberfestPotential candidate to participate in HacktoberfestIssue-Enhancementthe issue is more of a feature request than a bugResolution-FixedThe issue is fixed.Up-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Cmdletsgeneral cmdlet issues

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions