The 'user' variable during package installation

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
Murasakiiru
Messages: 4
Registration: Nov 15, 2016 - 6:11 p.m.

November 15, 2016 - 6:30 PM

Hello,

I'm trying to create a package with Wapt, and I'd like to send files to the User folder.
I tried using the user_appdata variable, which seemed like a good idea, but it keeps returning this error:

Otherwise, I tried `os.getenv(USERPROFILE): C:\Windows\system32\config\systemprofile`
or `os.getenv(USERNAME):`: returns my machine name and not my username.

I'm a bit stuck here. I understand that the commands are executed with the 'SYSTEM' user, hence the output I'm getting, but how do I fix this?

Thanks,
Mura.

EDIT: More descriptive title
User avatar
Aguay
Messages: 27
Registration: May 22, 2015 - 4:20 p.m.

November 16, 2016 - 5:07 PM

Hello,

are you targeting a specific user?
Or do you want to deploy something to all users on the machine?


You might want to check out https://dev.tranquil.it/sphinxdocs/sour ... local_users.

You'll certainly find other useful information there. ;)
And if you still can't find what you're looking for and/or don't know how to proceed, feel free to repost. :)

Good luck!
User avatar
htouvet
WAPT Expert
Messages: 436
Registration: March 16, 2015 - 10:48
Contact :

November 21, 2016 - 4:20 PM

To customize the installation of software in the user's context, a function must be added
session_setup
add to your package and include the additional actions


example :

Code: Select all

def install():
    # system wide
    run('...')
 
def session_setup():
    # un raccourci personnalise...
    create_user_desktop_shortcut('Navigateur pour %s'%get_current_user(), target = makepath(programfiles32,'Mozilla Firefox','firefox.exe'))
Tranquil IT
Locked