PowerShell / PowerShell/PSResourceGet

Scripts installed using `Save-PSResource -IncludeXml` are not discoverable by `Get-InstalledPSResource -Path`

Open
#1,447 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area-GetPSResource Issue-Bug
Dominant language
C#
Stars
576
Forks
114
Avg merge
1d 2h
Merged PRs (30d)
7

Description

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

Scripts installed with Save-PSResource -IncludeXml are not discoverable by Get-InstalledPSResource -Path.

Observed difference in behavior:

  • Save-PSResource -IncludeXml adds <script_name>_InstalledScriptInfo.xml to the same directory as the script itself.
  • Install-PSResource creates a directory InstalledScriptInfos where <script_name>_InstalledScriptInfo.xml is added.

I use Save-PSResource because Install-PSResource installs to OneDrive when known folder move (KFM) is enabled, and Install-PSResource has no override capabilities.

Reproduce:

# Create unique $InstallPath
$InstallPath = [string] '{0}\{1}' -f [System.Environment]::GetFolderPath('Desktop'), [datetime]::Now.ToString('yyyyMMddhhMMss')

# Create path
if (-not [System.IO.Directory]::Exists($InstallPath)) {
    $null = [System.IO.Directory]::CreateDirectory($InstallPath)
}

# Save a module and a script
Save-PSResource -Repository 'PSGallery' -TrustRepository -IncludeXml -Path $InstallPath -Name 'Az.Accounts'
Save-PSResource -Repository 'PSGallery' -TrustRepository -IncludeXml -Path $InstallPath -Name 'Get-WindowsAutoPilotInfo'

# List contents of $InstallPath
Get-ChildItem -Path $InstallPath

# Find installed PSResources
Get-InstalledPSResource -Path $InstallPath
Expected behavior

Modules "installed" using Save-PSResource is discoverable by Get-InstalledPSResource -Path, so should scripts be.

Actual behavior

See expected behavior.

Error details

No error message.

Environment data
  • Windows 11
  • PowerShell v7.3.8
  • Microsoft.PowerShell.PSResourceGet v1.0.0
Visuals
image

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 reproducing the documented Save-PSResource -IncludeXml and Get-InstalledPSResource -Path commands, comparing the script metadata location with the module metadata location. The work is done when scripts saved with IncludeXml are returned by Get-InstalledPSResource -Path, matching the stated expected behavior.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.