running MSU not working - batch-file

#echo off
start /wait wusa.exe %~dp0Win7AndW2K8R2-KB3134760-x64.msu /quiet /norestart
I have a .bat file with the above code. The file is located in \wds\e$\Shared\DeploymentBuild\Applications\Microsoft WMF 5.0.
The problem is, when I run it, it brings up the "Windows Update Standalone Installer" window and it won't do a silent install.
I have a copy of the same .bat file in my local computer, and it works fine without any issues. Please help me figure this out.
Thank you,
Tony

Start by changing your batch file accordingly:
#echo off
if not exist "%~dp0Win7AndW2K8R2-KB3134760-x64.msu" (
Echo= The MSU file isn't here!
Timeout -1 >Nul
Exit/B)
wusa.exe "%~dp0Win7AndW2K8R2-KB3134760-x64.msu" /quiet /norestart

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.

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.

Microsoft update msu silent mode batchfile

I have the MSU for Win7AndW2K8R2-KB3134760-x64, which includes updates for PowerShell 5.0
I have a batchfile with the following to run the MSU in silent mode, but when I run it, it brings up the CMD window, then closes fast.
#echo off
start /wait ".\Win7AndW2K8R2-KB3134760-x64.msu" /quiet /norestart
Try this
#echo off
start "" /wait "Win7AndW2K8R2-KB3134760-x64.msu" /quiet /norestart

MSIEXEC batch file works in W7 but not W8

I am having major issues getting a batch file to run correctly on Windows 8.
The below runs fine in Windows 7, however doesn't run in Windows 8. If I remove the /quiet flag I get the installer come up, but it asks me all the installation questions that the transform file is supposed to be answering.
#ECHO off
msiexec /i "\\syd-san01\software$\fortinet\forticlient.msi" TRANSFORMS="\\syd-san01\software$\fortinet\forticlient.mst" /quiet /norestart
pause
#exit
I have tried changing the TRANSFORMS= to TRANSFORM= and /t (no =) however this has made no difference.
Does anyone know of any changes to msiexec in Windows 8 that would stop this file from running correctly?
Thanks

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

Resources