/build/static/layout/Breadcrumb_cap_w.png

MSI deinstall / install / log over network

Hi folks!

Im trying to deploy and delete a MSI over a logon script which pushs my own process/script.

The solution should do the following steps:

1. DeInstall MSI from Machine
2. Log the success of the deinstallation
3. Install the new MSI on the Machine
4. Log the success of the installation
5. reboot if required

(everything in the background - silent)

till now:


@echo off

SET ProductCodeToInstall={4F34C602-4D6D-470D-A2A0-59E4F25DDBF22}
SET ProductCodeToRemove={26A24AE4-039D-4CA4-87B4-2F83216022FF}


reg.exe query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\%ProductCodeToRemove%" /v DisplayName

IF %ERRORLEVEL%==0 (
echo msiexec /qn /x %ProductCodeToRemove% REBOOT=R
echo %DATE% %TIME% %ProductCodeToRemove% removed...>>%COMPUTERNAME%.log
)


reg.exe query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\%ProductCodeToInstall%" /v DisplayName
IF NOT %ERRORLEVEL%==0 (
echo msiexec /qn /i "%ProductToInstall%" REBOOT=R


IF NOT %ERRORLEVEL%==0 (
IF NOT %ERRORLEVEL%==3010 (
echo %DATE% %TIME% %ProductToInstall% failed...>>%COMPUTERNAME%.log
)
echo %DATE% %TIME% %ProductToInstall% installed...>>%COMPUTERNAME%.log
)
echo %DATE% %TIME% %ProductToInstall% installed...>>%COMPUTERNAME%.log


)

Can you guys give me some feedback?

Regads,
newbie85

0 Comments   [ + ] Show comments

Answers (3)

Posted by: anonymous_9363 13 years ago
Red Belt
0
Feedback on what, exactly?

I would strongly suggest abandoning batch and using a scripting language, as batch's error-handling and branching is prehistoric.
Posted by: newbie85 13 years ago
Yellow Belt
0
Thx for your fast reply VBScab!

I will now using VBS. I need to now how to install or deinstall a msi and also how2 write a log?

something like:
------

msiCodeInstall = "{00000000-0000-0000-0000-000000000000}"
msiCodeDenstall = "{00000000-0000-0000-0000-000000000000}"

ReturnDeinstall = WshShell.Run("msiexec.exe /x" & msiCodeDenstall & " /qb!", 1, true)

--> write log deinstallation successfull or failed



ReturnInstall = WshShell.Run("msiexec.exe /i" & msiCodeInstall & " /qb!", 1, true)

If ReturnInstall <> 0 or ReturnInstall <> 3010
->> write log success
else
->> write log fail
End If

logfile should be the same file..

----

sorry for the obscure informations :S
Posted by: anonymous_9363 13 years ago
Red Belt
0
I was thinking more along the lines of using the WindowsInstaller.Installer object and testing the product's ProductState property.

If you want to still run command line, the log switch is '/L' e.g /L*V [path_to_and_name_of_log_file]
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ