PowerShell / PowerShell/PSScriptAnalyzer

Check automatic variable availability

Open
#1,400 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area - CompatibilityRules Issue - Enhancement Issue - New Rule Up-for-Grabs
Dominant language
C#
Stars
2.2k
Forks
414
Avg merge
13h 1m
Merged PRs (30d)
2

Description

In comparing the Preference Variables documentation for PowerShell 6.x and newer:
https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-6

to the Preference Variables documentation for PowerShell 5.1:
https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-5.1

it seems that a number of Preference Variables were removed/deprecated from PowerShell. I just ran into this problem unexpectedly on a script when testing it on PowerShell 6.x.

To help with this problem, I would like the PSUseCompatibleCommands feature of PSScriptAnalyzer to flag the usage of deprecated Preference Variables and state that they are not compatible with PowerShell 6.0 and newer (on any platform including Windows).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the linked PowerShell 6.x and 5.1 about_Preference_Variables documentation, then locate the PSUseCompatibleCommands feature in PSScriptAnalyzer. Done means deprecated preference-variable usage is flagged with a statement that it is incompatible with PowerShell 6.0 and newer on all platforms.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, powershell
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.