Question

I am building an HTA application for my office. We are using IE 9 on Windows 7. I have found how to retrieve the user name via javascript and VBA, but I have an issue. We log into our network with smart cards, and our user names are just numbers. The numbers are basically employee numbers. So when I get the user name from the local environment variable, it is just a number, which doesn't do me any good. Even our user folder is the same as our number. Interestingly, when you click the Start Menu, over in the right column at the top where your user name would normally appear, is our actual name plus our work center. This is exactly the info I need, but I don't know where it comes from. Possibly a network script plugs this info in? Even if you click it, which normally takes you to your user folder, the address at the top is exactly the same as what was in the Start Menu.

I tried searching the window registry for my name and the best solution I could come up with (yet still far away from practical) is reading the user name key value in Microsoft Office registry. Now, every computer should always have Office, but I don't like this approach one bit.

Our name is also stored on our Smart-Cards, but I imagine that is not something I can easily read from my application.

Anyone have another idea how I might be able to pull the information I am looking for?

Was it helpful?

Solution

You need to query ActiveDirectory for user details. You got user login so retrieving other user properties is easy.

You can try to use script from this answer VBA Retrieve the name of the user associated with logged username , but I suggest you to do this on server side. Just turn on Windows Authentication on IIS

OTHER TIPS

To see if the info is available copy these commands into a command prompt. Do any of them have what you are after.

wmic path Win32_Account get /format:list

wmic path Win32_Group get /format:list

wmic path Win32_GroupInDomain get /format:list

wmic path Win32_GroupUser get /format:list

wmic path Win32_SystemAccount get /format:list

wmic path Win32_SystemUsers get /format:list

wmic path Win32_UserAccount get /format:list

If you know your username that you want, search the registry for it. If your name is fred then type in Run dialog (Winkey + R)

reg query hkcu /f "fred" /s>"%userprofile%\desktop\reg.txt"

It put results into a txt file on your desktop.

What happens if you type cmd /k in Start Run.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top