Skip to content

WindowsPowerShell adapter should not discover resources unavailable in Windows PowerShell #707

Closed
@michaeltlombardi

Description

@michaeltlombardi

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest version
  • Search the existing issues.

Summary

In #698, a user reported an error trying to use a PSDSC resource with the Microsoft.Windows/WindowsPowerShell adapter. In that case, the root issue was that even though the adapter discovered a resource, it couldn't be used in the adapter because the PSDSC resource module was installed to a PowerShell module path, not in the Windows PowerShell module path.

The Windows PowerShell adapter should only discover and advertise resources usable in Windows PowerShell.

Checking my WindowsPSAdapterCache.json file showed PowerShell module folders alongside Windows PowerShell module folders, indicating the discovery process is somehow including modules that may have PSDSC resources but can't be discovered by the Windows PowerShell adapter and lead to confusing errors.

Steps to reproduce

  1. Invoke dsc resource list --adapter Microsoft.Windows/WindowsPowerShell
  2. Check the WindowsPSAdapterCache.json file for modules not discoverable by Windows PowerShell.

Expected behavior

The cache only includes modules available in Windows PowerShell.

Actual behavior

The module includes PowerShell module paths as well as Windows PowerShell paths.

Error details

Environment data

Name                           Value
----                           -----
PSVersion                      7.5.0
PSEdition                      Core
GitCommitId                    7.5.0
OS                             Microsoft Windows 10.0.26100
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Version

3.0.0

Visuals

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions