Ask a Question

Retrieve the domain of the logged-in user

SOLVED
simonaferrara
Frequent Contributor

Retrieve the domain of the logged-in user

Hi all,

 

I've got the need to retrieve the domain of the user logged-in within the machine, that is: not the domain of the machine, but the domain of the user, that could be the HostName if the user is a local one, of a specific domain if the user belongs to a domain.

 

I've found these properties but they don't match with the need:

- Sys.Domain (it is the domain of the machine)

- Sys.UserName (it is the username, but I've been not able to retrieve information about its domain)

 

Have you got any suggestion?

 

Thanks!

Simona

2 REPLIES 2
Irfan182
Occasional Visitor

Try the following:

 

sUserDomain = aqEnvironment.GetEnvironmentVariable("USERDOMAIN")

 

Irfan

simonaferrara
Frequent Contributor

@Irfan182 it works! Thank you very much!

cancel
Showing results for 
Search instead for 
Did you mean: