Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get the current users name in a custom action for windows installer?

I need to get the username of the user running the installer for my custom install action. Because the installer gets special priviledges, Environment.UserName just gives "SYSTEM".

Environment.SpecialFolders.ApplicationData returns the current users appdata folder, but I can't reliably dig the username out of it.

More case specifics:

Using a Visual Studio 2008 Setup Project The custom action is an installer class run after install and is the only one in the project.

like image 657
Septih Avatar asked Dec 21 '09 14:12

Septih


Video Answer


1 Answers

You can get some information from Environment variables. I am using

Environment.GetEnvironmentVariable("USERNAME");

to get current user name.

like image 165
Ankit Verma Avatar answered Nov 15 '22 06:11

Ankit Verma