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"):
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.
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 /?
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/
Related
I have an error in the PowerShell console with Chocolatey's link.
chocolatey's link error
If have not a solution, I need to learn how to install Chocolatey with the downloaded file "chocolatey.0.10.15.nupkg".
chocolatey's file .nupkg
Installing choco is a very common use case, including NuGet.
PowerShell already comes with a package manager that uses NuGet that it already installs by default. You can still install choco for other reasons, but for every day, normal PowerShell use, it's not needed.
Installing PowerShellGet
https://learn.microsoft.com/en-us/powershell/scripting/gallery/installing-psget?view=powershell-7
PowerShellGet is an in-box module in the following releases Windows 10
or newer Windows Server 2016 or newer Windows Management Framework
(WMF) 5.0 or newer PowerShell 6
Set your security level in your PowerShell session.
# Required for use with web SSL sites
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
If your ExecutionPolicy is set to AllSigned, then any script you run must be signed. Otherwise, set the ExecutionPolicy to RemoteSigned or ByPass in your user session.
How to Install Chocolatey using PowerShell
Set-ExecutionPolicy Bypass -Scope Process -Force; Invoke-Expression (
(New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')
)
Trying to set up my VSTS windows build agent to accommodate for powershell steps within VSTS but having some problems. Initially it reported that the AzurePS system capability was not present, so I made sure to install the latest Azure modules via the powershell gallery. Now, the AzurePS capability is present but certain powershell commands do not seem to work.
This may not be related to VSTS at all but rather just a configuration issue with my specific powershell installation / configuration. The full error is as follows:
The term 'Select-AzureRMSubscription' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
This error can be seen both in the VSTS release logs of the particular definition I am trying to execute, as well as when attempting to run the Select-AzureRMSubscription command directly on the box itself.
According to This MS Docs for Get-AzSubscription it's located in the module Az.Accounts.
So I had to run:
Install-module Az -AllowClobber -Force
Import-module Az
to make the command avaliable to me.
For me, updating the AzureRM module did the trick:
Update-Module -Name AzureRM
Depending on your system, you may get some messages while installing
Powershell requires NuGet provider version '2.8.5.201' or newer to
interact with NuGet-based repositories. The NuGet provider must be
available in 'C:\Program Files\PackageManagement\ProviderAssemblies'
or
'C:\Users\<...>\AppData\Local\PackageManagement\ProviderAssemblies'.
You can also install the NuGet provider by running
Install-PackagePovider -Name NuGet -MinimumVersion 2.8.5.201 -Force'.
Do you want PowerShellGet to install and import the NuGet provider
now?
[Yes] {No] [Suspend]
Choose "Yes"
You are installling the modules form an untrusted repository. If you
trust this repository, change its installationPolicy value by running
the Set-PSRepository cmdlet. Are you sure you want to install the
modules from 'PSGallery'?
[Yes] [Yes to All] [No] [No to All] [Suspend]
Choose "Yes to all"
Up to three modules will be installed/updated and directly after that, the Select-AzureRmSubscription should work immediately.
Select-AzureRmSubscription b0cabaca-1234-1337-abcd-bebedada1337
# note: this subscription GUID is completely fictional.
# To get the correct one, query your subscriptions with
# Get-AzureRmSubscription
You have to make sure that certain Azure Powershell modules are installed for certain cmdlets to work. You can check which modules are available by running Get-Module -ListAvailable. Select-AzureRMSubscription requires AzureRM module.
You could just install Azure Powershell with its modules using webPI - I've never had problems using it and I've heard that installing PS modules using gallery could cause problems (see here).
You can run azure PowerShell with Azure PowerShell step/task.
Edit your build definition
Click Add build step
Select Deploy catalog > Add Azure PowerShell step/task
the OS in question is server 2012
To install PowerShell on windows server 2012, we should add the .NET Framework 3.5 feature and add the windows PowerShell 2.0 Engine feature.
About how to add features, refer to the link.
Then we can download PowerShell installation package, and install it.
Then we can use windows server 2012 PowerShell to login azure.
You need to use the Set-AzContext,
Select-AzSubscription -SubscriptionName 'SubName' | Set-AzContext
I want to install MSI on my remote machine.Earlier I was using final builder which has an option to use pushtool to install MSI(pacakage) on servers.Now I have moved to jenkins and I am looking for any plugins which can be used to install the MSI .Another approach is calling pushtool.exe by powershell scripts.
Start-Process -FilePath "D:\PushInstall\PushInstall.exe" -ArgumentList "D:\PushInstall\installation.thom.DEV1.xml" -Wait
Even I gave -I option whhich stands for installation. But still it's not working.Can anyone help to solve this issue?
I have an NSIS installer executable which I would like to install silently for all users. I know I can pass the /S argument to do a silent install. The problem is that the default option for the installer is to install only for the current user. How can I change this option from the command line:
installer.exe /S
NSIS itself just supports /S, /NCRC and /D=c:\override\default\installdir\, everything else is up the author.
If the custom page from your screenshot was created with MultiUser.nsh and the author defined MULTIUSER_INSTALLMODE_COMMANDLINE then you could use installer.exe /AllUsers /S, otherwise you have to ask the author of the installer if they are checking for a specific command line switch.
If it turns out there is no way to do it then you would have to look into UI automation...
It turns out that for this particular installer you can pass:
/ALLUSERS=1
ALLUSERS is a standard MSI property. I did not find any documentation for this property in NSIS, so it looks like the developers of this particular installer added this.
I'm trying to setup a large number of build agents and so far i can install all the dependencies silently (using powershell, nuget and chocolatey).
However i cannot install the tool IlMerge without the damn GUI popping up.
Ive tried all the usual msiexec switches and they are just ignored. does anyone know of a way of getting this tool on a box in an unattended way?
Or should i just repack the thing in zip/msi?
This is on windows server 2008 R2
If i run
Invoke-Expression "msiexec $installerPath\ilmerge.msi /passive"
I still get a security dialog.
Currently i'm just thinking ill do this:
Copy-Item x:\installs\ilmerge.exe "C:\Program Files (x86)\ILMerge"
seeing as its only one file.
Below worked for me, no security dialogs.
cp ILMerge.msi \\Server\admin$
winrs -r:Server ILMerge.msi /passive
dir "\\Server\C$\Program Files (x86)\Microsoft\ILMerge"
With chocolatey you would have just needed to specify -ia '/quiet' as the package was not silent by default. This was specified by the tag notSilent and it was also in the description (http://chocolatey.org/packages/ilmerge/2.11.1103.1).
The latest package is just the executable, so you can just install it. http://chocolatey.org/packages/ilmerge