Page 1 of 1

[RESOLVED] Meshcentral Agent

Published: September 12, 2022 - 12:13 PM
by smandel
Good morning,

I am trying to deploy the Meshcentral agent using the tis-mesh-template package.
So I managed to get the agent installation unstuck; it was stuck because the mesh agent executables were showing a version "0.0.0.0".
So there shouldn't be any problems with the installation.

However, when I try to uninstall it from the console, I get this message:

Code: Select all

...Checking for previous installation of "\"Mesh" [NONE]
and subsequently the following error message and no uninstallation of the agent:

Code: Select all

Waiting for the removal of key: Mesh Agent from Windows registry
Fatal error : Uninstallkey still present
Traceback (most recent call last):
  File "C:\Program Files (x86)\wapt\waptservice\service.py", line 1894, in run
    self.running_task.run()
  File "C:\Program Files (x86)\wapt\waptservice\waptservice_common.py", line 692, in run
    self._run()
  File "C:\Program Files (x86)\wapt\waptservice\waptservice_common.py", line 1286, in _run
    self.result = self.wapt.remove(self.packagenames,
  File "C:\Program Files (x86)\wapt\common.py", line 5500, in remove
    setuphelpers.error('Uninstallkey still present')
  File "C:\Program Files (x86)\wapt\waptutils.py", line 1907, in error
    raise EWaptSetupException('Fatal error : %s' % reason)
waptutils.EWaptSetupException: Fatal error : Uninstallkey still present

EWaptSetupException: Fatal error : Uninstallkey still present
Traceback (most recent call last):
  File "C:\Program Files (x86)\wapt\waptservice\service.py", line 1894, in run
    self.running_task.run()
  File "C:\Program Files (x86)\wapt\waptservice\waptservice_common.py", line 692, in run
    self._run()
  File "C:\Program Files (x86)\wapt\waptservice\waptservice_common.py", line 1286, in _run
    self.result = self.wapt.remove(self.packagenames,
  File "C:\Program Files (x86)\wapt\common.py", line 5500, in remove
    setuphelpers.error('Uninstallkey still present')
  File "C:\Program Files (x86)\wapt\waptutils.py", line 1907, in error
    raise EWaptSetupException('Fatal error : %s' % reason)
waptutils.EWaptSetupException: Fatal error : Uninstallkey still present
Whereas I have no problems when I run the "uninstall" of the package under Pyscripter.
So I have the impression that the "uninstall" function of the package is not used during an uninstallation via WAPT.

THANKS.

Best regards.

Re: Meshcentral Agent

Published: September 12, 2022 - 2:58 PM
by jpele
Good morning,
It's likely you're testing the uninstallation via the Console on the development machine where you created and tested the package. That's why the installation isn't detected in the Console. I suggest you test it on another machine to validate the installation.

There is a print statement to that effect, which was displayed at the time of installation via PyScripter.

Code: Select all

    if not running_as_system():
        print("WARNING: %s will NOT be installed as SYSTEM account, it may cause issues" % app_name)
Sincerely,
Jimmy

Re: Meshcentral Agent

Published: September 12, 2022 - 3:16 PM
by smandel
Hello,

thank you for your reply.
I'm actually testing the package locally with PyScripter, then I upload it to the server and assign it to my PC.
The installation goes smoothly, as does the audit; it correctly retrieves all the information, including the ID for logging in via the WAPT console.
However, when I try to uninstall it via the WAPT console, I get these error messages, whether on my machine or another.

The uninstallation seems to launch the "remove" command and not the "uninstall" command.
The problem is, I have no control over what happens during the "remove" process.

Thank you.

Best regards.

Re: Meshcentral Agent

Published: September 12, 2022 - 3:46 PM
by smandel
Okay, I think I've just found it...
In fact, the agent's executable creates a bad "UninstallString" in the registry:

Code: Select all

C:\Program Files\Mesh Agent\MeshAgent.exe -funinstall --meshServiceName="Mesh Agent"
The correct string is as follows:

Code: Select all

C:\Program Files\Mesh Agent\MeshAgent.exe -fulluninstall
I must be on a buggy version... (meshcentral server version 1.0.85)

Re: Meshcentral Agent

Published: September 12, 2022 - 3:59 PM
by smandel
So, to solve the problem, I added the following to the end of install():

Code: Select all

registry_set(HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Mesh Agent","UninstallString","C:\Program Files\Mesh Agent\MeshAgent.exe -fulluninstall")

Re: Meshcentral Agent

Published: September 12, 2022 - 4:16 PM
by jpele
That's likely, as the tests were done on versions 0.9.84 and 1.0.0 (not certain).
I'll test it again anyway; it's been a while since I checked this package.
Please feel free to provide any additional information you may have, which could help us improve the package.

Re: Meshcentral Agent

Published: September 12, 2022 - 5:42 PM
by smandel
So, based on my tests for the moment, it's best to stay on the stable version 1.0.0:

Code: Select all

npm install meshcentral@1.0.0
At the WAPT level, add the previous key to the "install()".
And in the audit() function, add a 15-second sleep at the beginning to ensure the registry keys are created correctly:

Code: Select all

time.sleep(15)

Re: Meshcentral Agent

Published: September 16, 2022 - 4:24 PM
by jpele
Good morning,
Indeed, version 1.0 seems safer.
For your information, you can switch releases graphically from the web interface.
2022-09-15 16_22_20-MeshCentral.png
2022-09-15 16_22_20-MeshCentral.png (97.79 KB) Viewed 9154 times
The package has been updated; here is the changelog:

0.2.1.3-80

Package can now be fully customized interactively with update_package
Configuration is now based on JSON file "mesh-conf.json" graphically edited in update_package
Now using persistent folder to call JSON file locally with get_persistent_package_file()
Autofilling impacted_process
Fix uninstall by adding QuietUninstallString


Sincerely,
Jimmy