Firstly, in order for the installation and update of the agent to work when an uninstallation password is configured, you must not use the msi package (installation OK, update KO, the agent protection password is requested...).
An installation executable package must be created from the server that will work for installation and updates without requiring a password:
The adapted wapt package code:
Code: Select all
# -*- coding: utf-8 -*-
from setuphelpers import *
uninstallkey = ['{1841AFE1-4BA7-44D4-8700-6ACF860A8ED1}']
def install():
# Initializing variables
package_version = control.get_software_version()
# Vérification de la version pour gestion d'erreur
for to_install in installed_softwares('Trend Micro Apex One Security Agent'):
if Version(to_install["version"]) < Version(package_version) or force:
print ('installing %s' % control.package)
install_exe_if_needed('TrendMicroSecurityAgent.exe')
else:
print ('%s already installed' % control.package)
uninstallkey.remove('{1841AFE1-4BA7-44D4-8700-6ACF860A8ED1}')
For uninstallation, I suggest two solutions that I have tested:
Solution 1:
Disabling the uninstall password from the server console will set the "Allow Uninstall" registry key to 1 on the agents. Uninstallation is possible with the following code:
Code: Select all
def uninstall():
print ('uninstalling %s' % control.package)
run(r'"msiexec.exe" /x {1841AFE1-4BA7-44D4-8700-6ACF860A8ED1} /qn')
Solution 2:
Uninstallation is possible with the following code without disabling the password in the admin console (the password will be in plain text in the package):
Code: Select all
def uninstall():
print ('uninstalling %s' % control.package)
run(r'"%s\Trend Micro\Security Agent\pccntmon.exe" -m <uninstall_password>' % programfiles32)
source
Some leads that did not pan out:
Creating the executable package from the packager client relies on the ofcscan.ini configuration file on the server; editing this file allows you to find the agent's self-protection options:
[INI_CLIENT_SECTION]
SP_EnableFileProtection = 1
SP_EnableRegistryKeyProtection = 1
SP_EnableProcessProtection = 1
Unfortunately, setting them to 0 doesn't seem to work...
However, in the registry of the following agent, the keys for the self-protection options are indeed found:
HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\TrendMicro\PC-cillinNTCorp\CurrentVersion\AEGIS
By setting the "SP_EnableRegistryKeyProtection" key to 0, registry protection is indeed disabled, so the "Allow Uninstall" key can be modified again from within a WAPT package without disabling the agent's password. The problem is that it's not possible to modify the "SP_EnableRegistryKeyProtection" key while the agent is running... You first have to close the agent, which then prompts for the password... in short, I don't see how to fully automate the uninstallation within a WAPT package.