Solved

Getting logged on users from service application (win2k)

Posted on 2002-05-09
16
173 Views
Last Modified: 2010-04-04
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!!!!!
0
Comment
Question by:mdlittle
  • 5
  • 2
  • 2
  • +5
16 Comments
 
LVL 8

Expert Comment

by:Cesario
ID: 6999840
TAke a look at NetGroupGetUsers & NetUserGetGroups in the Windows SDK help
file (in the Delphi menu: "Help | Windows SDK")
0
 

Author Comment

by:mdlittle
ID: 6999857
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.
0
 
LVL 6

Expert Comment

by:swift99
ID: 6999900
Are they remote users logged into your service app, or are they concurrent local users on a WinXP box?
0
 

Author Comment

by:mdlittle
ID: 6999910
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.
0
 

Author Comment

by:mdlittle
ID: 6999925
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.
0
 
LVL 14

Expert Comment

by:AvonWyss
ID: 7000169
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.)
0
 
LVL 9

Expert Comment

by:ginsonic
ID: 7000595
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
0
 
LVL 4

Expert Comment

by:nestorua
ID: 7001473
HI,
You want to know who logged on some computer in your network
from another computer from this network?
Sincerely,
Nestorua.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:mdlittle
ID: 7001683
Listening.....
0
 
LVL 9

Expert Comment

by:ginsonic
ID: 7007680
mdlittle , my tip don't work for you ?
0
 

Author Comment

by:mdlittle
ID: 7008659
ginsonic,

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

Thanks,
0
 
LVL 6

Expert Comment

by:swift99
ID: 7008807
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.
0
 
LVL 1

Expert Comment

by:LoneA
ID: 7013118
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
0
 
LVL 1

Expert Comment

by:LoneA
ID: 7013119
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
0
 

Expert Comment

by:modulo
ID: 7648055
Dear expert(s),

A request has been made to close this Q in CS:
http://www.experts-exchange.com/Community_Support/Q_20439741.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
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 7654947
Saving this Q as a PAQ and refunding the points to the questionner

modulo

Community Support Moderator
Experts Exchange
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now