|
![]() |
#1 |
Junior Member
Join Date: Jul 2010
Posts: 32
|
How do I get the name of the current logged in user ?
I am running my installer with "admin" privileges and not "highest".
This means that some people in the office require an admin person to come along and log so the installer can start. However, my installer needs to find out the username of the person who launched the installer. I tried this: ReadRegStr $0 HKCU "Volatile Environment" "USERNAME" This worked on my machine and other machines I was logged into, but it didn't work on peoples machines who were not admins or had any kind of elevated privileges. I also looked at: System::Call "advapi32::GetUserName(t .r0, *i ${NSIS_MAX_STRLEN} r1) i.r2" But this simply returns the name of the admin who has come along and logged in, and not the user who originally launched it. How do I get the name of the person who originally launched my installer? |
![]() |
![]() |
![]() |
#2 |
Major Dude
Join Date: Feb 2007
Posts: 672
|
|
![]() |
![]() |
![]() |
#3 |
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,356
|
When you are asking for this type of information you are probably doing something wrong.
When you set RequestExecutionLevel admin you are doing a machine/all users install and you should put your stuff under $ProgramFiles and HKLM. If you need to do some per-user stuff then this should really happen the first time your application runs as that user (Copy template data from the install directory to $appdata etc) The "Active Setup" registry key can also be helpful... IntOp $PostCount $PostCount + 1 |
![]() |
![]() |
![]() |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|