Skip to content

Get-InstalledPSResource -ErrorAction Ignore -Path throws if path contains no directories #1815

@o-l-a-v

Description

@o-l-a-v

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

Get-InstalledPSResource -ErrorAction Ignore -Path throws if path contains no directories.

Reproduce:

# Make up a temp path
$TempPath = [string] [System.IO.Path]::Combine($env:TEMP,[datetime]::Now.ToString('yyyyMMddHHmmss'))

# Create said temp path
$null = [System.IO.Directory]::CreateDirectory($TempPath)

# Get installed modules from it
Get-InstalledPSResource -ErrorAction Ignore -Path $TempPath

Expected behavior

-ErrorAction Ignore should not throw

Actual behavior

It throws

Error details

Error cannot find expected subdirectories in provided path: <some_path>

Environment data

* Windows 11 24H2 x64
* PowerShell v7.5.0
* PSResourceGet v1.1.1

Visuals

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions