Link to home
Start Free TrialLog in
Avatar of mdlittle
mdlittle

asked on

Getting logged on users from service application (win2k)

I am writting a service application and am struggling to figure out how to get a list of the users who are logged into the system. I also need the (local and net name of the user '\\domain\user'). I need to know who is logged in and when someone logs in and out.

I am will to give 1500 points for accurate, useful code.  I will create 2 other empty questions to award the other 1000 points.

PLEASE HELP!!!!!
Avatar of Cesario Lababidi
Cesario Lababidi
Flag of Germany image

TAke a look at NetGroupGetUsers & NetUserGetGroups in the Windows SDK help
file (in the Delphi menu: "Help | Windows SDK")
Avatar of mdlittle
mdlittle

ASKER

I guess I was not clear. I need to know who is logged into the local computer, not a list of users in a group. Thanks for the answer.
Are they remote users logged into your service app, or are they concurrent local users on a WinXP box?
swift99:

They are simply users logged into the local machine. Although, I may have a need for WinXP support. The service app is started at bootup and, of course, runs under the system account. I tried WNetGetUser but that does not work running from the system account. I tried various other techniques but have hit deadends. I can get the user name if the service is started by the user but this is not going to work. My service app needs to know who is logged in interactively.
swift99:

They are simply users logged into the local machine. Although, I may have a need for WinXP support. The service app is started at bootup and, of course, runs under the system account. I tried WNetGetUser but that does not work running from the system account. I tried various other techniques but have hit deadends. I can get the user name if the service is started by the user but this is not going to work. My service app needs to know who is logged in interactively.
I think WNetGetUser is the way to go. Note that the service must not run in the system account if it want to access any network-related functions. Therefore, in your domain or on te computer, create a special user which is used exsclusively for this service and has enough rights to do all you need (e.g. for testing, make it an administrator. by choosing a long and complex password, there is virtually no risk that someone will be able to abuse this user account.)
Maybe this help...list information about all users currently logged on to a workstation?

http://www.swissdelphicenter.ch/torry/showcode.php?id=966&PHPSESSID=25d0a2c4937784f0a5892067dacc3948
HI,
You want to know who logged on some computer in your network
from another computer from this network?
Sincerely,
Nestorua.
Listening.....
mdlittle , my tip don't work for you ?
ginsonic,

no, it did not. I want to know who is logged into the computer not who is a user on a computer.

Thanks,
What is the function of your service app?

You may need to re-architect the app to deal with Windows security layers, and the actual business function of the app will dictate how it is architected.
Hi mdlittle

I found this article on www.microsoft.com

"This article demonstrates how to programmatically retrieve the user name and domain name for the interactively logged-on user on Microsoft Windows 95, Windows 98, or Windows Millennium Edition (Me) which is only possible by using the 16-bit LAN Manager NetWkstaGetInfo function."

http://support.microsoft.com/default.aspx?scid=kb;EN-US;q155698

Hope it is helpfull to you.

/LoneA
Hi mdlittle

I found this article on www.microsoft.com

"This article demonstrates how to programmatically retrieve the user name and domain name for the interactively logged-on user on Microsoft Windows 95, Windows 98, or Windows Millennium Edition (Me) which is only possible by using the 16-bit LAN Manager NetWkstaGetInfo function."

http://support.microsoft.com/default.aspx?scid=kb;EN-US;q155698

Hope it is helpfull to you.

/LoneA
Dear expert(s),

A request has been made to close this Q in CS:
https://www.experts-exchange.com/questions/20439741/Please-delete-these-questions.html

Without a response in 72 hrs, a moderator will finalize this question by:

 - Saving this Q as a PAQ and refunding the points to the questionner

When you agree or disagree, please add a comment here.

Thank you.

modulo

Community Support Moderator
Experts Exchange
ASKER CERTIFIED SOLUTION
Avatar of modulo
modulo

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial