Open KevinMarquette opened 5 years ago
@KevinMarquette thanks for reporting this, I see why this can be confusing/unexpected.
The behavior of -Confirm
is set to $false
by default, but when you specify the parameter it adds an additional check to confirm you want this behavior ex.
And it does not affect the behavior of other checks in place.
Whether the bahavior of -Force in this case is expected is something to discuss since Force generally not tied to Installation Policy, but instead to installation conflicts.
Thank you, That will work for my use case.
Over use of -Force
was causing me issues in other places.
In case someone finds this Issue via Google (since it's pretty high up in the results) having the same problem as me trying to install "AzureADPreview" yet still getting a confirmation prompt despite using -Confirm:$false
here's an even simpler solution.
Simply do Set-PSRepository -Name 'PSGallery' -InstallationPolicy Trusted
to shortly set PSGallery as trusted, then use Install-Module
to install whatever module you want, optionally use Set-PSRepository -Name 'PSGallery' -InstallationPolicy Untrusted
to set it back to an Untrusted state for security reasons.
Found this tip here: https://evotec.xyz/powershellgallery-you-are-installing-modules-from-an-untrusted-repository/
In case someone finds this Issue via Google (since it's pretty high up in the results) having the same problem as me trying to install "AzureADPreview" yet still getting a confirmation prompt despite using
-Confirm:$false
here's an even simpler solution.Simply do
Set-PSRepository -Name 'PSGallery' -InstallationPolicy Trusted
to shortly set PSGallery as trusted, then useInstall-Module
to install whatever module you want, optionally useSet-PSRepository -Name 'PSGallery' -InstallationPolicy Untrusted
to set it back to an Untrusted state for security reasons.Found this tip here: https://evotec.xyz/powershellgallery-you-are-installing-modules-from-an-untrusted-repository/
I'm running into this same issue trying to Install-Module PSDiscoveryProtocol
in a PDQ deployment (which runs Powershell in non-interactive mode) unfortunately Set-PSRepository -Name 'PSGallery' -InstallationPolicy Trusted
doesn't work either - as this command also tries to prompt and fails in the non-interactive session with the same error message...
So far I can't find a way to get this to work.
In case someone finds this Issue via Google (since it's pretty high up in the results) having the same problem as me trying to install "AzureADPreview" yet still getting a confirmation prompt despite using
-Confirm:$false
here's an even simpler solution. Simply doSet-PSRepository -Name 'PSGallery' -InstallationPolicy Trusted
to shortly set PSGallery as trusted, then useInstall-Module
to install whatever module you want, optionally useSet-PSRepository -Name 'PSGallery' -InstallationPolicy Untrusted
to set it back to an Untrusted state for security reasons. Found this tip here: https://evotec.xyz/powershellgallery-you-are-installing-modules-from-an-untrusted-repository/I'm running into this same issue trying to
Install-Module PSDiscoveryProtocol
in a PDQ deployment (which runs Powershell in non-interactive mode) unfortunatelySet-PSRepository -Name 'PSGallery' -InstallationPolicy Trusted
doesn't work either - as this command also tries to prompt and fails in the non-interactive session with the same error message...So far I can't find a way to get this to work.
Has anyone found a workaround for this
When installing modules from an untrusted repository, I have to specify
-Force
instead of-Confirm:$false
to suppress the prompt. The issue with using-Force
is that it forces the reinstall of all the dependent modules.Steps to reproduce
Expected behavior
The module should not prompt for input
Actual behavior
Environment data