In batch script silent installation using Reboot=reallysuppress is not updating the files - batch-file

I am using batch Script for silent Installation to update the locked and in use files.Using silent installation reboots my system automatically after the update.But I wanna setup a custom reboot message box , So I used the REBOOT=ReallySuppress attribute. And I used a message box to popup the custom reboot message. This helps me avoid the auto-reboot of the system but it is not updating the files even after performing a manual reboot.
Here is the script that I am using.
#echo off
title Installing Updates
msiexec /i "C:\Users\tparvathaneni\Documents\Visual Studio 2015\Projects\SetupProject1\SetupProject1\bin\Debug\SetupProject1.msi" /qn /REBOOT=ReallySuppress
echo updates installed
echo msgbox "Restart your system to complete the installation." > "%temp%\popup.vbs"
wscript.exe "%temp%\popup.vbs"
pause >NUL
shutdown.exe /r /t 000
Can someone give me a solution to get the files updated with manual reboot.

did you try instead of /REBOOT=ReallySuppress the /norestart option?
Please also make a log file in the install cammand via /l option. Then read the log if really the installer reboots the computer.

Related

MSI installer does not install when executed from a batch file

I am currently creating an improvised installer for a cople software packages. To do this I have to install a couple MSI packages first before doing a couple file operations.
To install an MSI package I am using the following command:
start /wait msiexec /i "Myinstaller V2.1.msi" /qb
This command works and installs the package instantly and witout any problems via CMD.
But when I put this command in my batch file and execute it as an administrator, I get the following error:
This installation package could not be opened. Contact the application vendor to verify that this is a valid Windows Installer package
What cold be the problem? Using the same command via the console works flawlessly, only the batch file throws the error...
EDIT: I have also tried the /a parameter in order to install it as an administrator and it does not work either. Full command in batch file:
start /wait msiexec /qn /a "Myinstaller V2.1.msi"
EDIT2: I just realized that it only does not work when I start the batch file with Right click > Run as administrator
When I open a console with administrative rights and start my batch file it works for some reason...
Is there a way to make it work with the Right click > Run as administrator method?
SOLUTION: Thanks to RGuggisberg's answer I now know that the directory changes once the file is executed as an administrator. With a small change the installer gets fired up as an admin and works perfectly starting the installer from a relative path in the same directory:
#echo off
pushd %~dp0
start /wait msiexec /i "Myinstaller V2.1.msi" /qb
pause
I've now also implemented a feature to detect wether or not the installation fails or not:
#echo off
pushd %~dp0
start /wait msiexec /i "Myinstaller V2.1.msi" /qb
if %ERRORLEVEL% EQU 0 echo SUCCESSFULL
if NOT %ERRORLEVEL% EQU 0 echo MyProgram installation FAILED
pause
The current directory changes when you run as administrator. If you want to prove that to yourself, see this post
Difference between "%~dp0" and ".\"?
Include the full path to your filename and it will work.

Issue installing MSI silently using msiexec, possible syntax issue?

Essentially I would like to install an msi file silently, and I've got it to work using the following line:
msiexec /i C:\Users\%username%\Downloads\mysqlODBC.msi /passive
One addition I would like to make is to add double quotes to the user name portion of the line to ensure any usernames that may contain spaces are read correctly. ----> "%username%"
The issue is the msi file fails to install when I add this. I have always used this when writing batch scripts with directories. Any idea how this can be addressed to work with msiexec?
Link to MSI file I am trying to quietly install:
https://dev.mysql.com/downloads/file/?id=484649
Network Installation Point?: It is not quite clear to me what you are trying to achieve. Do you want to automate the installation of this MSI on many machines? If so you should create a network installation point accessible via a UNC path and run an administrative image to extract all files and create a network installation point that can be used for all computers:
msiexec.exe /i "\\Server\Share\Setup.msi" /QN /L*V "C:\Temp\msilog.log"
If you have that instillation point there really is no reason to make a folder for each user. Why duplicate installation files? Surely you don't want each user to download the installer? You would want to download once, malware check and then rely on what you downloaded once and for all?
Anyway, if you insist:
msiexec.exe /i "\\Server\Share\%username%\Setup.msi" /QN /L*V "C:\Temp\msilog.log"
Quick Parameter Explanation:
/i = run install sequence
/QN = run completely silently
/L*V "C:\Temp\msilog.log"= verbose logging at specified path
msiexec.exe: See this answer for some further details on the msiexec.exe command line: MSIEXEC what is the difference between qn and quiet. There are two different flavors of it - two different sets of switches: old style and some newer, "friendlier" versions. I only use the old style switches. There is a tool you can use to generate the command lines.
Some Links:
Customize msiexec progress bar?
How to install an MSI silently
TL; DR :
pushd "C:\Users\%username%\Downloads\"
msiexec.exe /a "mysqlODBC.msi" /quiet /norestart /log "%cd%\msiexec_install.log"
popd
Details :
While the fully qualified path should be able to placed in-between double-quotes, an alternative option would be to use pushd and popd to move to an from the directory containing the MSI.
In the example above, I replaced the progress bar (aka /passive) with /quiet. I also used /a rather than /i out of habit - either can be used to install. And I included a log-to-file option which can be useful in troubleshooting.

Batch file - Add a log file for every .exe executed

for /r %%f in (*.exe) do (start /wait %%f /quiet /norestart #echo "Done" >> E:\WindowsUpdate\Alog.txt)
I want to create a log file for every file that is executed to check its properties with the code above. These files are vcredist (Microsoft Visual c++ updates). But it only creates the log file and writes nothing. Any help will do.
Those executables should use msiexec.exe which has a standard option for logging information.
`… /quiet /norestart /log E:\WindowsUpdate\Alog.txt`
If this is not what you mean then please update your question with more information because your question talks about logging information and your comment checking a check box.

windows update uninstall batch file

KB3114409 KB2825678 windows update patch files you may know that has caused many user to only be able to launch outlook in safe mode. that means i can not find anybody in outlook, anyway it is no good patch to me.
so i made batch file for our staff that is for uninstalling windows patch about KB3114409 KB2825678. it seems to be looking those file and uninstall. but if i have a look in installed update console, there is still remain those two.
i execute this batch file in administrator mode as well, but still same in.
#echo off
Wusa /KB:3114409 /Uninstall
Wusa /KB:2825678 /Uninstall
exit
i made it like that, but i still have those patches...
i use win7 64bit and using user mode, not administrator mode.
please any idea..?
Not sure if you really have everything on one line or if your post just turned out that way. This is what I use:
#echo off
start "" /b /wait wusa.exe /uninstall /kb:3114409 /quiet /norestart
start "" /b /wait wusa.exe /uninstall /kb:2825678 /quiet /norestart
To put all commands on one line you would need to separate them with &
but that makes it a bit harder to read. Also see WUSA /?
Its better to use MSIEXEC to remove this patch since its an "Office patch" and not for Windows.
Tutorial and script approach described at: http://blog.jocha.se/tech/uninstall-outlook-kb3114409

How to let msi package install process take place in cmd instead of windows installer gui

How can I make a batch file that automatically installs java,office and adobe stuff without gui, instead of that I want to let whole proces take place inside the command prompt. For example I want to have a bar inside the command prompt telling me how far the install process is. How do I make that, I can't find it on the internet. Here is a example of what I already have:
#echo off
echo Installing application...
msiexec.exe /passive /i "%~dp0skypesetup.msi"
echo Install failed.
pause
Here I have the msi file if you wanna help me: http://www.skype.com/go/getskype-msi
Does anyone knows how to make a program with percent bar inside the command promt?
For the external GUI you can check MsiSetExternalUI function (follow the links). For installing silently the basic msiexec.exe command line is:
msiexec.exe /I "C:\MsiFile.msi" /QN /L*V "C:\msilog.log"
Quick explanation:
/I is for install
/QN is silent mode
/L*V is verbose logging
Some links:
Silent Install of MSI
What is different about a silent installation session
Common msiexec.exe command lines
Here is an answer that discusses alternative ways to install a package without using msiexec.exe
How to disable an extra window to restart system even after selecting not to do so in files in use dialog in installshield
Stupid me :( , I'v searched a lot and finally found it. I thought I had to use msi but I can also do it with .exe files. Stupid me.
Here's the code if someone wants it or needs it:
#ECHO OFF
echo Do you want to install ccleaner
pause
ccleaner.exe /S /L=1043
echo You've succesfully installed ccleaner
pause

Resources