:INSTALL
; Create some string values for use later
$regPath="HKEY_LOCAL_MACHINE\SOFTWARE\"
$appsPath="\\xxx\xxx\Installs\xxx\"
;-------------------------
; exclude all Servers and Domain Controllers from login updates and
; installs just in case some idiot logs in locally at the console
$OSVal = @PRODUCTTYPE
IF ( (INSTR ($OSVal,"Server") <> 0) OR
(INSTR ($OSVal,"Domain Controller") <> 0) )
GOTO "END"
ENDIF
;----------------------------
$BaseKey = 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{199B7F78-69B7-47C5-8D4B-A3ED1391FB6B}'
If KeyExist($BaseKey)
$return = MESSAGEBOX("The system has determined that a newer version of xxxx "
+ "is available for your computer. Before it can be installed "
+ "the present version must be removed. When the uninstall is "
+ "completed, a reboot will be required. To begin the removal "
+ "please click on OK.", "xxx uninstall", 64)
$UninstallString = Join(Split(ReadValue($BaseKey,'UninstallString'),'/I{'),'/X{') + ' /qn'
Run $UninstallString
RUN $appsPath + "xxx\setup.exe" + " REMOVE=ALL REBOOT=F/qb+/i"
GOTO "END"
EndIf
;---------------------------------------------------
:END