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 =)
 
Back
Top