Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Install / Deinstall / Log MSI

Status
Not open for further replies.

newbie85

Technical User
Feb 8, 2011
1
CH
Hi folks!

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

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)

Ive created a batch file to do this but Ive heard that it would be better to use VBS because it offers more possibilities.


@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,
newbie
 
Ive created a batch file to do this but Ive heard that it would be better to use VBS because it offers more possibilities.
What exactly are you looking for from a VB script that your current script does not/cannot do?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top