-WhatIf On By Default in PowerShell Cmdlets

I recently came across this blog post on setting -WhatIf on by default in PowerShell. While it works just fine for many use cases, it only seems to apply at the level of an admin's PowerShell session (i.e. by setting the global $WhatIfPreference. I wanted to take it a…

Dependency Pinning in PowerShell

TL;DRIf you want to use version pinning/freezing, do not opt for the standard #Requires statement. Instead, use Import-Module with the -RequiredVersion parameter and -Scope Local parameters:Import-Module MyModule -RequiredVersion 1.0 -Scope LocalBetter yet, put all your modules and versions in a list of hashmaps and iterate through:…