[RESOLVED] Meshcentral Agent

Questions about WAPT Packaging / Requests and help regarding Wapt packages.
Forum Rules
Community Forum Rules
* English support on www.reddit.com/r/wapt
* French community support is available on this forum
* Please prefix the topic title with [RESOLVED] if it is resolved.
* Please do not edit a topic that is tagged [RESOLVED]. Open a new topic referencing the old one.
* Specify the installed WAPT version, full version, and build number (2.2.1.11957 / 2.2.2.12337 / etc.) as well as the Enterprise/Discovery edition.
* Versions 1.8.2 and earlier are no longer supported. The only questions accepted regarding version 1.8.2 are related to upgrading to a supported version (2.1, 2.2, etc.).
* Specify the server OS (Linux/Windows) and version (Debian Buster/Bullseye - CentOS 7 - Windows Server 2012/2016/2019).
* Specify the OS of the administration/package creation machine and the machine with the problematic agent, if applicable (Windows 7/10/11/Debian 11/etc.).
* Avoid asking multiple questions when opening a topic, otherwise it may be ignored. If there are multiple topics, open separate topics, preferably one after the other and not all at the same time (i.e., do not spam the forum).
* Include code snippets, screenshots, and other images directly in the post. Links to Pastebin, Bitly, and other third-party sites will be systematically removed.
* As with any community forum, support is provided voluntarily by members. If you require commercial support, you can contact Tranquil IT's sales department at 02.40.97.57.55
Locked
smandel
Messages: 111
Registration: May 5, 2022 - 11:30

September 12, 2022 - 12:13

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.
User avatar
jpele
Messages: 156
Registration: March 4, 2019 - 12:01
Location: Nantes

September 12, 2022 - 2:58 PM

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
smandel
Messages: 111
Registration: May 5, 2022 - 11:30

September 12, 2022 - 3:16 PM

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.
smandel
Messages: 111
Registration: May 5, 2022 - 11:30

September 12, 2022 - 3:46 PM

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)
smandel
Messages: 111
Registration: May 5, 2022 - 11:30

September 12, 2022 - 3:59 PM

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")
User avatar
jpele
Messages: 156
Registration: March 4, 2019 - 12:01
Location: Nantes

September 12, 2022 - 4:16 PM

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.
smandel
Messages: 111
Registration: May 5, 2022 - 11:30

September 12, 2022 - 5:42 PM

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)
User avatar
jpele
Messages: 156
Registration: March 4, 2019 - 12:01
Location: Nantes

September 16, 2022 - 4:24 PM

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 9155 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
Locked