Page 1 of 2

[RESOLVED] Self-Service and the current user

Published: February 12, 2026 - 11:05 AM
by stan
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

Re: Self-Service and the current user

Published: February 12, 2026 - 11:24 AM
by sfonteneau
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

Re: Self-Service and the current user

Published: February 12, 2026 - 11:41
by stan
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?

Re: Self-Service and the current user

Published: February 12, 2026 - 11:49 AM
by sfonteneau
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é")
    
    

Re: Self-Service and the current user

Published: February 12, 2026 - 12:07 PM
by stan
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.

Re: Self-Service and the current user

Published: February 12, 2026 - 2:09 PM
by dcardon
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

Re: Self-Service and the current user

Published: February 13, 2026 - 3:16 PM
by stan
Hello,

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

Have a good day!

Re: Self-Service and the current user

Published: February 13, 2026 - 3:59 PM
by stan
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!

Re: Self-Service and the current user

Published: February 13, 2026 - 6:00 PM
by sfonteneau
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

Re: Self-Service and the current user

Published: March 17, 2026 - 11:06
by stan
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 :)