How to obtain current user's organization ?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I know I can use Environment.UserName to obtain the current user name, but
how can I get his organization too ? These two infos are available when users
install Windows, but it seems to me the framework only provides the former.

Thanks.
 
Check this key in the registry:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\

It has a string:
RegisteredOrganization

Which contains the information you are looking for. You can access it using
the Microsoft.Win32 namespace, look for the Registry class in the object
browser.

Chris

p.s. Incase you want to be lazy, this is the code:
Microsoft.Win32.Registry.GetValue(
@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\",
"RegisteredOrganization", null ).ToString()
Enjoy =)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top