PowerShell / PowerShell/PSScriptAnalyzer

-SaveDscDependency does not work on Microsoft-hosted 'ubuntu-latest' agents

Open
#2,096 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue - Bug
Dominant language
C#
Stars
2.2k
Forks
414
Avg merge
13h 1m
Merged PRs (30d)
2

Description

Steps to reproduce

Invoke-ScriptAnalyzer -Path . -Recurse -ReportSummary -SaveDscDependency -EnableExit

We have some new scripts which rely on DSC modules (for example 'nxtools', 'PSDscResources' and 'SecurityPolicyDSC'). RestrictRDPForLocalAccounts.ps1 is one of the PowerShell script files that used DSC modules. While executing the PSScriptAnalyzer scan with the -SaveDscDependency option on the Microsoft-hosted 'ubuntu-latest' agents in our CI/CD pipeline, the DSC modules are not saved:

Image

The same command works fine on Microsoft-hosted 'windows-latest' agents:

Image

Expected behavior

The DSC modules are downloaded and the script files are scanned the same way as on Windows.

Actual behavior

The DSC modules are not downloaded and the scan list parse errors.

Environment data

Microsoft-hosted 'ubuntu-latest' agents
PowerShell 7.4.7
PSScriptAnalyzer: 1.24.0

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 running Invoke-ScriptAnalyzer with -SaveDscDependency on a Microsoft-hosted ubuntu-latest agent and compare it with windows-latest, using the reported DSC modules and RestrictRDPForLocalAccounts.ps1. Done means the DSC modules are downloaded and the script files scan without the reported parse errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
cli, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.