WAPT antivirus removal package
Published: February 15, 2022 - 11:01 AM
Good morning,
I'm trying to create a package to uninstall the old antivirus via a registry key, but there are several different versions, therefore several registry keys.
I want it to check the registry keys and if it exists it uninstalls it and if it does not exist it moves on to the next one and at the end install the new anti-virus and if it is x64 install the 64-bit version or if it is an x86 operating system install the 32-bit version.
Attached is the script I started writing but it's not working.
Thank you in advance to anyone who can help me.
I'm trying to create a package to uninstall the old antivirus via a registry key, but there are several different versions, therefore several registry keys.
I want it to check the registry keys and if it exists it uninstalls it and if it does not exist it moves on to the next one and at the end install the new anti-virus and if it is x64 install the 64-bit version or if it is an x86 operating system install the 32-bit version.
Attached is the script I started writing but it's not working.
Thank you in advance to anyone who can help me.
Code: Select all
# -*- coding: utf-8 -*-
from setuphelpers import *
# Usable WAPT package functions: install(), uninstall(), session_setup(), audit(), update_package()
# Declaring global variables - Warnings: 1) WAPT context is only available in package functions; 2) Global variables are not persistent between calls
def install():
print("Installing: %s" % control.package)
if uninstall_key_exists('{867E468E-DD24-4599-8A61-C4454DD166FE}'):
run('MSIEXEC.exe /qb /X {867E468E-DD24-4599-8A61-C4454DD166FE} REBOOT="ReallySuppress" PASSWORD="mot de passe" /q')
elif uninstall_key_exists('{367F9C22-8DC9-4880-A14B-29B01881B05C}'):
run('MSIEXEC.exe /qb /X {367F9C22-8DC9-4880-A14B-29B01881B05C} REBOOT="ReallySuppress" /q')
else: uninstall_key_exists('{B454B5C8-5C87-4F24-B9F5-2A9A199F08F5}')
run('MSIEXEC.exe /qb /X {B454B5C8-5C87-4F24-B9F5-2A9A199F08F5} REBOOT="ReallySuppress" /q')
else: uninstall_key_exists('{7F98FC14-7576-4980-8985-BD5377EA765E}')
run('MSIEXEC.exe /qb /X {7F98FC14-7576-4980-8985-BD5377EA765E} REBOOT="ReallySuppress" PASSWORD="mot de passe" /q')
else: uninstall_key_exists('{7B3EFEF0-4D31-4221-8BA3-B1B1CBBAA5B8}')
run('MSIEXEC.exe /qb /X {7B3EFEF0-4D31-4221-8BA3-B1B1CBBAA5B8} REBOOT="ReallySuppress" /q')
else: uninstall_key_exists('{92BA3DCC-50FA-4636-939F-254D454D2559}')
run('MSIEXEC.exe /qb /X {92BA3DCC-50FA-4636-939F-254D454D2559} REBOOT="ReallySuppress" /q')
else: uninstall_key_exists('{26172EAA-2147-47B0-ABFB-D5FF4E6D4274}')
run('MSIEXEC.exe /qb /X {26172EAA-2147-47B0-ABFB-D5FF4E6D4274} REBOOT="ReallySuppress" PASSWORD="mot de passe" /q')
else: uninstall_key_exists('{7B3EFEF0-4D31-4221-8BA3-B1B1CBBAA5B8}')
run('MSIEXEC.exe /qb /X {7B3EFEF0-4D31-4221-8BA3-B1B1CBBAA5B8} REBOOT="ReallySuppress" /q')
else: uninstall_key_exists('{8DDDE767-7175-46A3-BF28-939E8B755617}')
run('MSIEXEC.exe /qb /X {8DDDE767-7175-46A3-BF28-939E8B755617} REBOOT="ReallySuppress" PASSWORD="mot de passe" /q')
else: uninstall_key_exists('{92BA3DCC-50FA-4636-939F-254D454D2559}')
run('MSIEXEC.exe /qb /X {92BA3DCC-50FA-4636-939F-254D454D2559} REBOOT="ReallySuppress" /q')
else: uninstall_key_exists('{3F509AE4-E4F1-4418-B0C2-92766748DC02}')
run('MSIEXEC.exe /qb /X {3F509AE4-E4F1-4418-B0C2-92766748DC02} REBOOT="ReallySuppress" PASSWORD="mot de passe" /q')
else: uninstall_key_exists('{F9699917-447C-4109-9479-5161D1636B24}')
run('MSIEXEC.exe /qb /X {F9699917-447C-4109-9479-5161D1636B24} REBOOT="ReallySuppress" /q')
else: uninstall_key_exists('{082F6817-E4B9-406D-8E59-0551070D7B97}')
run('MSIEXEC.exe /qb /X {082F6817-E4B9-406D-8E59-0551070D7B97} REBOOT="ReallySuppress" PASSWORD="mot de passe" /q')
else: uninstall_key_exists('{E75932C3-67DD-42A7-A413-E748199C17C2}')
run('MSIEXEC.exe /qb /X {E75932C3-67DD-42A7-A413-E748199C17C2} REBOOT="ReallySuppress" PASSWORD="mot de passe" /q')
else: uninstall_key_exists('{19E36B07-F888-4822-BF50-49F9EA520018}')
run('MSIEXEC.exe /qb /X {19E36B07-F888-4822-BF50-49F9EA520018} REBOOT="ReallySuppress" PASSWORD="mot de passe" /q')
else: uninstall_key_exists('{CAC9C8AF-7485-48E0-AF87-FDC929B57E76}')
run('MSIEXEC.exe /qb /X {CAC9C8AF-7485-48E0-AF87-FDC929B57E76} REBOOT="ReallySuppress" PASSWORD="mot de passe" /q')
def install():
print("Installing: %s" % control.package)
if iswin64():
print('Pc x64')
run(r'"agent_cloud_x64.msi" -q /norestart')
else:
print('Pc not x64')
run(r'"agent_cloud_x86.msi" -q /norestart')