[RESOLVED] Self-Service and the current user

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
stan
Messages: 17
Registration: May 26, 2025 - 10:16 p.m.

February 12, 2026 - 11:05

Hello,

I'm posting this because I have a question.

I created a custom package to install Proton Authenticator; it's an MSI installation, but the installation path is the local appdata directory of the user who launched the MSI.

I wanted to add it to the Self-Service menu so that Proton Authenticator could be installed by anyone. However, with the Self-Service menu, it installs for the "System" user, and even with `session_setup()`, I can't do that. Could you

please clarify this for me? :D
Last edited by stan on Apr 21, 2026 - 11:32, edited 3 times.
User avatar
sfonteneau
WAPT Expert
Messages: 2318
Registered: July 10, 2014 - 11:52 PM
Contact :

February 12, 2026 - 11:24

Good morning
stan wrote: Feb 12, 2026 - 11:05 even with a session_setup() I can't do it.
Why can't you? In this case, the session_setup should be correct
stan
Messages: 17
Registration: May 26, 2025 - 10:16 p.m.

February 12, 2026 - 11:41

sfonteneau wrote: Feb 12, 2026 - 11:24 Good morning
stan wrote: Feb 12, 2026 - 11:05 even with a session_setup() I can't do it.
Why can't you? In this case, the session_setup should be correct
I can't use the self-service*
I tried something like that for self-service, but it doesn't work:

Code: Select all

def install():
    session_setup()

def session_setup():
    bin_name = glob.glob("ProtonAuthenticator*.msi")[0]
    install_msi_if_needed(bin_name)
    print("Proton Authenticator a été installé")
Do you have a way to install it for the user who clicks install instead of installing it on the System user?
User avatar
sfonteneau
WAPT Expert
Messages: 2318
Registered: July 10, 2014 - 11:52 PM
Contact :

February 12, 2026 - 11:49

A small correction to your code

Code: Select all


def install():
    bin_name = glob.glob("ProtonAuthenticator*.msi")[0]
    filecopyto(bin_name , r'c:\test.msi')

def session_setup():
    bin_name = r'c:\test.msi'
    install_msi_if_needed(bin_name)
    print("Proton Authenticator a été installé")
    
    
stan
Messages: 17
Registration: May 26, 2025 - 10:16 p.m.

February 12, 2026 - 12:07

Thank you so much, it works now.

Do you have any ideas for uninstalling it?

Running "run('msiexec /x' + bin_name + '/q')" doesn't work.
User avatar
dcardon
WAPT Expert
Messages: 1929
Registration: June 18, 2014 - 09:58
Location: Saint Sébastien sur Loire
Contact :

February 12, 2026 - 2:09 PM

Hi Stan,

the equivalent of the `uninstall()` function for cleaning up user sessions is the `session-cleanup()` function. It runs in the user context with the user's privileges.

https://www.wapt.fr/en/doc/wapt-create- ... on-cleanup

Regards,

Denis
Denis Cardon - Tranquil IT
Share your experiences on WAPT! Send us your blog and article URLs in the "Your Opinion of the forum, and we'll feature them on the WAPT
stan
Messages: 17
Registration: May 26, 2025 - 10:16 p.m.

February 13, 2026 - 3:16 PM

Hello,

thank you very much, I wasn't aware that this function existed; it must be quite recent.

Have a good day!
stan
Messages: 17
Registration: May 26, 2025 - 10:16 p.m.

February 13, 2026 - 3:59 PM

dcardon wrote: Feb 12, 2026 - 2:09 PM Hello Stan,

the equivalent of the uninstall() function for cleaning up user sessions is the session-cleanup() function. It runs in the user context with the user's privileges.

https://www.wapt.fr/en/doc/wapt-create- ... on-cleanup

Regards,

Denis
Hello again,

After trying the session_cleanup() function, nothing happens...

Here is my code:

Code: Select all

def session_cleanup():
    run("msiexec /x " + new_path + " /qn")
    remove_file(new_path)
The command works fine with my user but on the other hand does not work with the "session_cleanup()" function, even when using "wapt-get session-setup packagename" nothing happens.

Thank you for being able to enlighten me :D

Have a good weekend!
User avatar
sfonteneau
WAPT Expert
Messages: 2318
Registered: July 10, 2014 - 11:52 PM
Contact :

February 13, 2026 - 6:00 PM

Hello,

In order:

- Increment the version of the package containing session_cleanup

- install the package with this new version

- uninstall the package

- run the command `wapt-get session-setup ALL`

Simon
stan
Messages: 17
Registration: May 26, 2025 - 10:16 p.m.

March 17, 2026 - 11:06

Good morning,

After performing the operation about ten times, nothing happens.

Here is my script:

Code: Select all

# -*- coding: utf-8 -*-
from setuphelpers import *

new_path = makepath(programdata(), "wapt", "ProtonAuthenticator.msi")

def install():
    bin_name = glob.glob("ProtonAuthenticator*.msi")[0]
    filecopyto(bin_name , new_path)
    if isfile(new_path):
        print("Proton Authenticator a été copié dans " + new_path)
        return
    else:
        print("Erreur lors de la copie de Proton Authenticator dans " + new_path)
        return "ERROR"

def session_setup():
    try:
        install_msi_if_needed(new_path)
    except Exception as e:
        print("Erreur lors de l'installation de Proton Authenticator : " + str(e))
        return "ERROR"
    print("Proton Authenticator a été installé")
    return "OK"

def session_cleanup():
    run("msiexec /X" + new_path + " /qn")
    remove_file(new_path)
When I enter the commands, I get this:

Code: Select all

C:\Users\stan>wapt-get remove X-proton-authenticator
Désinstallation de X-proton-authenticator mis en file d'attente

Désinstallé(s) : X-proton-authenticator

C:\Users\stan>wapt-get session-cleanup ALL
Using config file: C:\Program Files (x86)\wapt\wapt-get.ini
1

C:\Users\stan>wapt-get session-cleanup ALL
Using config file: C:\Program Files (x86)\wapt\wapt-get.ini
0
It went from 1 to 0 so for me it should work but it doesn't.

However, if I execute the line in CLI "msiexec /XProtonAuthenticator.msi /qn" it works fine.

Thanks in advance :)
Locked