Using Msiexec repair with transform - command

After instaling an msi package using transforms :
msiexec /i MyInstaller.msi MSINEWINSTANCE=1 TRANSFORMS=:I01
I want to repair this installed instance, so I try this command line:
msiexec /fa MyInstaller.msi TRANSFORMS=:I01
But I got this error:
"This action is only valid for products that are currently installed"
My question is how to repair with msiexec this instance?
Thank you

Reference the installed instance by its [ProductCode]:
msiexec /fa {????????-????-????-????-????????????}
where {????????-????-????-????-????????????} is replaced by the actual product code.

I finally used REINSTALL argument and it worked just fine.
msiexec /i MyInstaller.msi TRANSFORMS=:I01 REINSTALL=ALL REINSTALLMODE=omus

Related

Powershell,Silent Installation not working

Need to install a sample.msi file through powershell,i have written command like below
msiexec.exe /I c:\fakepath\sample.msi /quiet
I am not getting any errors and application is also not installing
Note:Same piece of code is working,when i have tried it in c# code by using PowerShellInstance.BeginInvoke(); it is working
I am always getting windows installer prompt (GUI message box).
Windows ® Installer. V 5.0.17763.404
msiexec /Option <Required Parameter> [Optional Parameter]
Install Options
</package | /i> <Product.msi>
...

Silent install of application with PowerShell

I'm working to automate the install of some of our software and was able to do so using a batch file, but was having issues with getting the silent install working in PowerShell.
The batch file which is working properly to install the application is:
#echo off
start /wait Setup.exe -s -l=EN
echo %errorlevel%
I've tried the following code in PowerShell, but the GUI installer will appear when I attempt to run it.
cmd.exe /c "Start /wait c:\temp\application\setup.exe -s -l=EN"
I don't receive any error messages when running the PowerShell script, it just doesn't install the application silently.
Try this:
&{ "c:\temp\application\setup.exe" -s -l=EN }
This should call an external Commandline command from Powershell.
The braces are not always strictly necessary either if you are just running the command and not doing anything with the output the following would likely work
& c:\temp\application\setup.exe -s -l=EN

SCCM - Accept a dialog box via command line to uninstall a simple MSI

I'm trying to uninstall a simple MSI via SCCM but when I start the command line, this message appears "Are you sure to uninstall this application ?" and I have the "Yes or No" choice.
I tried with this command line: msiexec /x {D582312F-07B5-434A-8CBB-F6793440CD0C} /qn
But nothing is happening because I think the command line is stuck when the question is asked.
Anybody have had the same problem and have a solution to respond "Yes"?
Thansk a lot in advance,
G. Cotting

Install arguments breaking an automated PowerShell install

I'm installing SQL Data Tools via a PowerShell script. I run my script, but the final part where the Data Tools are installed fails (inside of the SQL installer window). If I run the script without that part, and install Data Tools manually it works.
The error is:
VS Shell installation has failed with exit code -2147205120.
The parts before this install .NET and SQL Server Management Studio. I don't think they're relevant to my issue, but I will post that part if requested. Here are the relevant parts. The first try block installs SQL SP1 (removed now for readability), the second installs Data Tools and SNAC_SDK.
try
{
Write-Host "Lauching SQL Server Data Tools install ..."
& "\\mynetworkpath\SSDTBI_x86_ENU.exe" "/ACTION=INSTALL" "/FEATURES=SSDTBI,SNAC_SDK" "/Q" "/IACCEPTSQLSERVERLICENSETERMS"
Write-Host "Installer launched ..."
}
catch
{
Write-Host "SQL Server Data Tools installation failed"
exit
}
I have tried juggling around the arguments for the Data Tools install part, and playing with the -wait verb to make sure SP1 is done for sure, but no luck.
EDIT: Per Matt's suggestion I added /NORESTART to my argument list, but now it doesn't install anything, and doesn't error either...
EDIT: Added updated code with quoted arguments. Still doesn't work, but I think it's closer than it was originally.
I think the comma in the arguments is the culprit here because powershell interprets entities separated by comma as an array.
You can see how parameters get passed with this little hack
& { $args } /ACTION=INSTALL /FEATURES=SSDTBI,SNAC_SDK /Q /IACCEPTSQLSERVERLICENSETERMS
which gives
/ACTION=INSTALL
/FEATURES=SSDTBI
SNAC_SDK
/Q
/IACCEPTSQLSERVERLICENSETERMS
To get rid of this problem you need to quote at least the FEATURES argument. I usually quote everything in those cases, just to be consistent, so
& { $args } "/ACTION=INSTALL" "/FEATURES=SSDTBI,SNAC_SDK" "/Q" "/IACCEPTSQLSERVERLICENSETERMS"
gives you the wanted parameters:
/ACTION=INSTALL
/FEATURES=SSDTBI,SNAC_SDK
/Q
/IACCEPTSQLSERVERLICENSETERMS
Update: Many installers return immediately after they have been called while the install process still runs in the background, which can be a bugger when the rest of the script depends on the install.
There are several methods to make powershell wait for a process exit. One of the shortest is to use Out-Null like this:
& "\\mynetworkpath\SSDTBI_x86_ENU.exe" "/ACTION=INSTALL" "/FEATURES=SSDTBI,SNAC_SDK" "/Q" "/IACCEPTSQLSERVERLICENSETERMS" | Out-Null
You may also want to look at $? or $LASTEXITCODE afterwards to check for errors.

Commandline install MSI takes too long

For some reason trying to install a msi executable trough commandline takes too long or never completes. The program is unsigned themes for windows that allows you to run unsupported themes on windows. Its available from here: Download
Im trying to install the 64bit version with:
start /wait "UxStyle Core x64.msi"
The whole batch file looks like this:
#echo off
net stop uxsms
IF "%PROCESSOR_ARCHITECTURE%" == "AMD64" call :install64
IF "%PROCESSOR_ARCHITECTURE%" == "x86" call :install32
IF ERRORLEVEL 1 goto :UxStyleErr
takeown /f "%WINDIR%\Resources\Themes\Aero\aero.msstyles"
icacls "%WINDIR%\Resources\Themes\Aero\aero.msstyles" /grant %USERNAME%:F"
ren "%WINDIR%\Resources\Themes\Aero\aero.msstyles" aero.msstyles.original
copy /y aero.msstyles "%WINDIR%\Resources\Themes\Aero\"
net start uxsms
echo Installation completed. Press any key to reboot or close this dialog if you want to restart later.
pause
shutdown /r /t 0
goto :eof
:install64
start /wait "UxStyle Core x64.msi"
goto :eof
:install32
start /wait "UxStyle Core x86.msi"
goto :eof
:UxStyleErr
echo An error occured while installing UxStyle Core. Installation will now quit.
pause
goto :eof
What am i doing wrong?
Instead of using start /wait to launch the .msi file, I'd recommend calling msiexec.exe directly. You'll also be able to generate a log file which will help you diagnose what is going wrong. So I'd modify your start /wait commands to look like:
msiexec /i "UxStyle Core x64.msi" /l*v x64_installlog.txt
You can add /passive or /quiet to the command to show just a progress bar or run with absolutely no UI respectively.
Please read:
Msiexec (command-line options)
It looks like you are lacking the /QB or /QB switches to run without interaction. Also consider adding REBOOT=R to prevent them MSI from executing any unexpected reboots.