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

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
echo msiexec /qn /i "%ProductToInstall%" REBOOT=R

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?

0 Comments   [ + ] Show Comments


Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.


Feedback on what, exactly?

I would strongly suggest abandoning batch and using a scripting language, as batch's error-handling and branching is prehistoric.
Answered 02/08/2011 by: VBScab
Red Belt

Please log in to comment
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
->> write log fail
End If

logfile should be the same file..


sorry for the obscure informations :S
Answered 02/08/2011 by: newbie85
Yellow Belt

Please log in to comment
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]
Answered 02/08/2011 by: VBScab
Red Belt

Please log in to comment
Answer this question or Comment on this question for clarity