Skip to content

Install-PSResource throws Operation is not valid due to the current state of the object #1821

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
3 tasks done
Gijsreyn opened this issue May 9, 2025 · 0 comments
Open
3 tasks done

Comments

@Gijsreyn
Copy link

Gijsreyn commented May 9, 2025

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

I am experiencing an issue when installing a PowerShell module. When a module is installed while elevated, and then tries to reinstall it under an unelevated session, the error: Operation is not valid due to the current state of the object is thrown. This is quite ambiguous and should error out because it is not elevated.

Expected behavior

Throw an error that access is denied

Actual behavior

Operation is not valid due to the current state of the object

Error details

Environment data

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Binary     1.1.0      preview1   Microsoft.PowerShell.PSResourceGet  {Find-PSResource, Get-InstalledPSResource, Get-PS…

Key   : PSVersion
Value : 7.4.7
Name  : PSVersion


Key   : PSEdition
Value : Core
Name  : PSEdition


Key   : GitCommitId
Value : 7.4.7
Name  : GitCommitId


Key   : OS
Value : Microsoft Windows 10.0.19045
Name  : OS


Key   : Platform
Value : Win32NT
Name  : Platform


Key   : PSCompatibleVersions
Value : {1.0, 2.0, 3.0, 4.0…}
Name  : PSCompatibleVersions


Key   : PSRemotingProtocolVersion
Value : 2.3
Name  : PSRemotingProtocolVersion


Key   : SerializationVersion
Value : 1.1.0.1
Name  : SerializationVersion


Key   : WSManStackVersion
Value : 3.0
Name  : WSManStackVersion

Visuals

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant