LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

app.username not working

I have an application in which I am trying to use a property node to determine who the user is so as to customize the GUI.  When I run it on my development PC (either the dev environment or the built app.), the App.UserName property correctly reports the user logged on.  On the deployed system it correctly reports one of the logins, but for the Administrator it only reports "User".  I found this posting, but I have no idea where to find the user name in the registry.

Jim

LV 2020
0 Kudos
Message 1 of 3
(2,736 Views)

Hi Imtis,

 

As far as I know there isn't a way to read the actual user name though the registry. If you bring up the run box (Windows Key+R) and type "regedit" then you can go to the HKEY_CURRENT_USER\Identities\current user ID alphanumeric then there is an entry for username but, at least on my machine, this just shows "Main Identity". If you see the username there then you can point to it with the Read Registry Value Simple.vi but otherwise you would have to call the environment username, which there isn't a function for in LabVIEW.

 

Do you know if the original username for the Administrator was "User"? I've seen that sort of layover functionality in Windows before where it will latch onto the name that you installed with and despite changes to the username itself the OS still regards it as the original name. An easy way to check if this is the case would be to create a new user and then change the username and run your code to see which name is displayed.

0 Kudos
Message 2 of 3
(2,720 Views)

You can look at the HKCU\Volatile Environment\USERNAME key.

 

You can also use .NET to get this information (do a search as examples have been posted for this method).

Message 3 of 3
(2,708 Views)