This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using namespace System.Management.Automation.Language | |
using namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic | |
function IncorrectUseOfFormatCmdletsInMiddleOfPipeline { | |
<# | |
.SYNOPSIS | |
Do not place format-table in the middle of a pipeline | |
.DESCRIPTION | |
Detects when Format commands are commonly misused in the middle of a pipeline, causing unexpected results with display objects that dont have the same properties as the original piped object. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this snippet describes how to automatically clean up | |
# changes in environment varables | |
# it can clean up re-writing, adding and removing | |
# scroll down to see how to use it in real test | |
Get-Module Pester | Remove-Module | |
Import-Module Pester -MaximumVersion 4.9.9 | |
function Get-Environment { | |
$vars = Get-Item Env:\ |