Page 1 of 1

[SOLVED] Shortcut creation problem

Published: Dec 27, 2022 - 5:52 PM
by Clement
Good morning,

Installed WAPT version: 2.2.3.12481, Enterprise edition.
Server OS:
Operating system (administrative machine/package creation): Windows 10

(I have put the information specific to my company in brackets.)

I'm having trouble creating a package. I want to create a desktop shortcut that points to our ticketing tool, and for that, I created this Python script:

Code: Select all

def session_setup():
    create_user_desktop_shortcut(r'Formulaire-GLPI',target='http://support-informatique[...].fr/')
I don't get an error message when I run "wapt:session-setup" from PyScripter:

Code: Select all

Command Line : session-setup "c:\waptdev\[...]-FormulaireGLPI_1_x64_Windows_PROD-wapt\WAPT\.."
Using config file: C:\Program Files (x86)\wapt\wapt-get.ini
Configuring c:\waptdev\[...]-FormulaireGLPI_1_x64_Windows_PROD-wapt ...
Running session_setup for package [...]-FormulaireGLPI(=1-0) and user [...]
Done
But I don't have a shortcut added to my desktop.
My boss ran it on his machine and it works, so it's not the script.

I think it might be due to a config file on my machine but I can't see which one (I've already gone through wapt-get.ini).

I'm afraid I'll be blocked from creating any more packages.

Do you have any idea what could be causing this?

Thank you in advance.


Sincerely,
Clement

Re: Problem creating shortcut

Published: Dec 27, 2022 - 6:34 PM
by julien.guyonnet
Hello,

I find the behavior of session_setup sometimes difficult to predict.

This is linked to the various launch contexts:
- from Pyscripter (launched with an admin account on the development machine)
- package installation from the wapt console (only one user logged into the machine)
- from the self-service
- during shutdown.

The question I consistently ask myself is, "Which account is it running under?"

Re: Problem creating shortcut

Published: Dec 29, 2022 - 11:54 AM
by sfonteneau
julien.guyonnet wrote: Dec 27, 2022 - 6:34 PM - from Pyscripter (launched with an admin account on the dev machine)
with the session that launched PyScripter, therefore the admin account

julien.guyonnet wrote: Dec 27, 2022 - 6:34 PM - Package installed from the wapt console (only one user connected to the machine)
The session setup will be launched in all sessions opened with the user's account (this is an impersonation)
julien.guyonnet wrote: Dec 27, 2022 - 6:34 PM - from the self-service area
Same as the previous case (impersonation)

julien.guyonnet wrote: Dec 27, 2022 - 6:34 PM - during the extinction
No session is open at this time, so session setup is not launched. However, since session setup is opened every time a session is opened, it will run at the next session opening

ATTENTION :arrow:

It's important to remember that session setup runs only once per package version and only once per session. Therefore, if you create a shortcut on a user's desktop and they delete it, the next execution of session setup will not recreate the shortcut, as it has already been run in the session for package version 1.0-2.

Re: [SOLVED] Shortcut creation problem

Published: January 3, 2023 - 5:50 PM
by Clement
Good morning,

I created a new script this time for the Office 365 installation:

Code: Select all

def install():

    if not installed_softwares(u'O365BusinessRetail'):
        print('Microsoft Office 365: Installation en cours...')

        run(u'OfficeSetup.exe /configure ConfigurationOffice365.xml',timeout=2000,accept_returncodes=[1641,3010,0])

        print('Microsoft Office 365: Installation OK')
    else:
        print('Microsoft Office 365: Deja installe!')

    if not isdir(makepath(programefiles,'Microsoft Office','OfficeClickToRunWAPTUninstall')):
        mkdirs(makepath(programefiles,'Microsoft Office','OfficeClickToRunWAPTUninstall'))
    filecopyto ('OfficeSetup.exe',makepath(programfiles,'Microsoft Office','OfficeClickToRunWAPTUninstall','ConfigurationUninstall.xml'))

def uninstall():

    print('Microsoft Office 365: Desinstallation...')

    #Closing applications:
    killalltasks(['WINWORD.EXE','POWERPNT.EXE','EXCEL.EXE','MSPUB.EXE','MSACCESS.EXE','ONEDRIVE.EXE','OUTLOOK.EXE','ONENOTE.EXE','Teams.exe'])

    #Uninstalling:
    if installed_softwares(u'O365BusinessRetail'):
        if isfile(makepath(programfiles,'Microsoft Office','OfficeClickToRunWAPTUninstall','OfficeSetup.exe')):
            run('"' + makepath(programfiles,'Microsoft Office','OfficeClickToRunWAPTUninstall','OfficeSetup.exe') + r'" /configure UninstallOffice365.xml',timeout=2000,accept_returncodes=[1641,3010,0])
            remove_file(makepath(programfiles,'Microsoft Office','OfficeClickToRunWAPTUninstall','OfficeSetup.exe'))
            remove_file(makepath(programfiles,'Microsoft Office','OfficeClickToRunWAPTUninstall','UninstallOffice365.xml'))
            if dir_is_empty(makepath(programfiles,'Microsoft Office','OfficeClickToRunWAPTUninstall')):
                remove_tree(makepath(programfiles,'Microsoft Office','OfficeClickToRunWAPTUninstall'))

    print('Microsoft Office 365: Desinstallation terminee')
Same as before: no error message, but not the expected result either:

Code: Select all

Command Line : install "c:\waptdev\[...]-microsoft-office_16.0.15225.20288_x64_Windows_PROD\WAPT\.."
Using config file: C:\Program Files (x86)\wapt\wapt-get.ini
Installing WAPT files c:\waptdev\[...]-microsoft-office_16.0.15225.20288_x64_Windows_PROD
Installing: OfficeSetup.exe
Installing: OfficeSetup.exe (16.0.15225.20288)

Results :

 === install packages ===
  c:\waptdev\[...]-microsoft-office_16.0.15225.20288_x64_Windows_PROD | [...]-microsoft-office (16.0.15225.20288-0)
Since I already have Office installed on my computer, I should at least have received the message "Microsoft Office 365: Already installed!" but nothing happens.

Any ideas?

Thank you in advance.


Sincerely,
Clement

Re: [SOLVED] Shortcut creation problem

Published: January 4, 2023 - 12:34 PM
by dcardon
Hello Clément,

please do not reuse an existing thread for a new topic. If you have a new question, please start a new thread.

Regards,

Denis