Skip to content
This repository was archived by the owner on Jun 13, 2024. It is now read-only.
This repository was archived by the owner on Jun 13, 2024. It is now read-only.

Q: Intended behavior for Parameters "-Force" "-Confirm" in Install-PackageProvider (and others) #62

@WernerMairl

Description

@WernerMairl

Hi
Please help me to understand the intended behavior for -Force and -Confirm!

My Usecase: "Install-PackageProvider"
Requirements:

  1. ensure a certain minimumversion of a provider (-MinimumVersion)
  2. no confirmation dialog needed (assuming answer YES) (-Confirmation:$false)
  • not for trust in download source
  • not for overriding existing version
  1. No Download/install needed if just installed (-Force:$false)
  2. do all of that with one commandlet (Usability/nice to have)

Sample
on my machine the Version 2.8.5.127 of the Nuget Packageprovider is installed.
my script should "ensure" that Version 2.8.5.201 (-Minimumversion) is installed

in our first try we are using the following call:

Install-PackageProvider -Name "NuGet" -MinimumVersion "2.8.5.201" -Scope "CurrentUser"

result: PS-ISE shows a Confirmation Dialog for a not trusted Repository (https://oneget.org)
After a click on OK it installs the Packageprovider => OK and expected behavior

My next challange: how suppress that Confirmation Warning ?
proposed solution by Powershell (general)
use "-Confirmation:$false"

BUT: this does not helps!
It seems that "Install-PackageProvider" ignores the -Confirmation Settings for that security question!

Workaround: with the -Force Switch i'm able to work around this problem... the Confirmation-Dialog does NOT shows up.

My question about this:
In my understanding the "-Force" switch has another meaning
it should solve/override questions about versioning/overriding installed versions.

But here the -Force switch is used for 2 different purposes => conflict.
purpose 1: security/trust on download sources
purpose 2: install-behavior (override or not)

Is this a bug in the Install-PackageProvider Cmdlet?
(some other PowerShellGet cmdlet seems to have the same behavior)

regards
Werner

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions