Can a service running as NetworkService see logged on users?

S

Stephen Corey

I've got a windows service running as NetworkService on a WinXP Pro
machine. Is there a way for it to find the Active Directory account of
the logged on user? I don't mind switching the service to run as a
"Domain Admin" if needed, but I *need* to find out the LDAP path for the
user.

Thanks!
 
W

William DePalo [MVP VC++]

Stephen Corey said:
I've got a windows service running as NetworkService on a WinXP Pro
machine. Is there a way for it to find the Active Directory account of the
logged on user? I don't mind switching the service to run as a "Domain
Admin" if needed, but I *need* to find out the LDAP path for the user.

There isn't necessarily a _single_ logged on user in light of terminal
services, fast user switching etc.

That said, this link

http://msdn.microsoft.com/library/d...authn/security/enumerating_logon_sessions.asp

shows how to enumerate all of logons on a system and this link

shows how to get information about each one:

http://msdn.microsoft.com/library/d...rity/retrieving_logon_session_information.asp

The two links should get you started. Please post follow-up in the kernel
group:

microsoft.public.win32.programmer.kernel

Regards,
Will
 

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

Top