PowerShell defines many built-in global variables by default. When you reference one of these variables in a script or module using the "global:" scope qualifier, PSScriptAnalyzer generates a warning due to how the PSAvoidGlobalVars rules is written. When the variable is a global, built-in variable though, this warning should not be generated.
PSAvoidGlobalVars should be modified to exclude built-in, global variables that are defined by PowerShell.
Thanks @KirkMunro, we will fix this issue soon.
Hi @KirkMunro, in our implementation, we have already excluded most of the built-in variables when identifying global variables. Do you know which ones we are missing?
Seems like this issue is already fixed.