How can I suppress "What if" text being written to the console
I commonly use SupportsShouldProcess in my PowerShell functions along with $PSCmdlet.ShouldProcess() so I can sanity-check what a script is going to do. Generally I only implement this around actions that will change the environment, e.g. Add-, New-, Set- cmdlets, etc. In some cases I also want to bypass Get- cmdlets when running a script with the -WhatIf switch. For example: I have a script that fingerprints all files in a folder using Get-FileHash before doing something to each file. In this example there are 10k+ files with an average size of 100MB or more and I don't want to spend time act
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.