Page 1 of 1

"Auto-migration" (uninstallation/reinstallation) via the audit() function and system context

Published: November 25, 2025 - 12:05 PM
by i551f
Hello everyone,

I am currently working on a script to standardize our software inventory. My goal is to periodically identify software that has been installed manually (outside of WAPT) and, if it corresponds to a package in our store, to force its uninstallation and reinstall it properly via WAPT.

I had considered using the audit() function for this task, with logic like this:

Code: Select all

def audit():
    # ... logique de détection ...
    if logiciel_hors_wapt_detecte:
        # Tentative de désinstallation
        run(WAPT.uninstall_cmd(app["msi_product_code"]))
        return "ERROR" # Pour déclencher une réinstallation ?
    return "OK"
However, I have doubts about the relevance and technical feasibility of this method, and I would like to confirm my intuition with you:

Execution context: audit() is executed by the WAPT service (Local System). If the uninstallation command invokes a graphical interface (even a simple confirmation), I imagine it will fail or hang because the service cannot interact with the user session (Session 0 problem)?

User interaction: Similarly, I imagine that using waptguihelper to notify the user is prohibited in the audit for the same reasons?

Is it recommended to make "heavy" changes (uninstallation) in the audit(), or should the audit simply report an "ERROR" status?

If audit() is not the right place, what is the best practice for this scenario? Is there another recommended mechanism (session_setup())?

Sincerely

Re: "Auto-migration" (uninstallation/reinstallation) via the audit() function and system context

Published: November 25, 2025 - 12:27 PM
by sfonteneau
Good morning
i551f wrote: Nov 25, 2025 - 12:05 PM Hello everyone,

I'm currently working on a script to standardize our software. My goal is to periodically identify software that has been installed manually (outside of WAPT) and, if it matches a package from our store, force its uninstallation and reinstall it properly via WAPT.
The easiest way is to uninstall it from the wapt package.

If you install teams
If the WAPT Teams package is not installed, then install it. (The WAPT Teams installation package will uninstall Teams or correct the Teams installation if necessary.)

Regarding the GUI issue, it's a broader problem; the uninstallation must be silent. While it's possible to redirect a system account display to a standard user session, this is clearly a major security risk. Therefore, a method for performing a silent uninstallation must be found.

Re: "Auto-migration" (uninstallation/reinstallation) via the audit() function and system context

Published: November 25, 2025 - 7:48 PM
by vcardon
Also, i551f, your goal should also be to understand how and why users still install software themselves.

If they can currently install/run software not supported by WAPT, then the first solution is to remove admin rights and apply SRPs to their home directories.

Otherwise, you'll spend all your time whack-a-moleing, and WAPT will only serve to bandage a growing, infected wound.