powershellnuget

run install-package without it prompting to install nuget


I'm trying to install an msi using install-package on a group of remote computers, but I kept getting the interactive prompt to install nuget. Is there any way to turn off that prompt?

install-package software.msi

The provider 'nuget v2.8.5.208' is not installed.
nuget may be manually downloaded from
https://onegetcdn.azureedge.net/providers/Microsoft.PackageManagement.NuGetProvider-2.8.5.208.dll and installed.
Would you like PackageManagement to automatically download and install 'nuget' now?
[Y] Yes  [N] No  [S] Suspend  [?] Help (default is "Y"):

Solution

  • Apparently you CAN install raw MSIs from Install-Package. In order to not get prompted for the Nuget provider installation, as well as prevent other prompts from happening, running Install-Package with the MSI provider:

    Install-Package -ProviderName msi -Force software.msi
    

    Not saying it's impossible, but at the surface I don't see a way to pass additional arguments into the MSI for Powershell 6 and later (Powershell 5.1 does have an -AdditionalArguments parameter). So keep this in mind if you have MSI installers that do need additional parameters passed in. If I find a way to do this I will update the answer.