简体   繁体   中英

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"):

I think you're looking for msiexec , not Install-Package as the latter installs a specially formatted package from a repository.

If you want to install software.msi with msiexec , you can do so like this:

msiexec /i $pathToSoftwareMsi /qn

If you want to write the installation log to a file, you can add logging parameters:

msiexec /i $pathToSoftwareMsi /qn /l*v $pathToOutputLogFile

Explaining the Parameters

  • /i : Tells msiexec to install the package
  • /qn : the q tells msiexec to execute with no user interaction. The n sets the UI level to No UI . These are instrumental for ensuring the installer doesn't ask for input during an unattended installation.
  • /l*v : Log the output to the specified file. /l indicates you want to output the log to a file, and the *v indicates all logging options plus verbose.

You can see the full range of options by running msiexec /?

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.

Nuget install command:

install-packageprovider nuget -force

Install-Package is used to install NuGet packages in the context of a .NET project mostly.

To install an msi, you can just run the msi or use msiexec. I found a good explanation here: https://powershellexplained.com/2016-10-21-powershell-installing-msi-files/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM