473,385 Members | 1,764 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to best determine any/all Logged On Users from a VB .NET Servi

I wrote a VB .NET Service to restart the computer when certain business rules
are triggered (such as not being rebooted in x days, no users logged on, time
is 1-3 am, etc.).

I am currently using a sloppy technique of checking the Registry to
determine if and who is logged on.

I would like to use a Microsoft sanctioned best-practice method of
determining if anyone is logged on (and their Username and all Process Names
that the User is running, etc.) from the Service. It will run on XP Pro, but
eventually Server 2003, etc.

I think I should be using the WindowStation and Desktop related API calls,
but cannot find good documentation on how to do it from Visual Basic .NET and
the proper sequence. I need some code snippets for something like,
EnumDesktops(), OpenWindowStation(), etc.

Any help from Microsoft ? (or anyone else that has done this).
Jul 21 '05 #1
2 4528
I would look into the WMI if I were you. I'm not sure if it has the info you
want, but it's a good start. You can get just about anything you need about
the system from the WMI.

David
"RickPowell" wrote:
I wrote a VB .NET Service to restart the computer when certain business rules
are triggered (such as not being rebooted in x days, no users logged on, time
is 1-3 am, etc.).

I am currently using a sloppy technique of checking the Registry to
determine if and who is logged on.

I would like to use a Microsoft sanctioned best-practice method of
determining if anyone is logged on (and their Username and all Process Names
that the User is running, etc.) from the Service. It will run on XP Pro, but
eventually Server 2003, etc.

I think I should be using the WindowStation and Desktop related API calls,
but cannot find good documentation on how to do it from Visual Basic .NET and
the proper sequence. I need some code snippets for something like,
EnumDesktops(), OpenWindowStation(), etc.

Any help from Microsoft ? (or anyone else that has done this).

Jul 21 '05 #2
Rick,
In addition to the other comments, you might be able to use the the
NetWkstaUserEnum Win32 api to retrieve the information.

I have not used it from a service yet.

http://groups-beta.google.com/group/...d390cf3dc29eec

(if the above link does not work, search groups.google.com for
NetWkstaUserEnum in the microsoft.public.dotnet.languages.vb newsgroup,
there is a thread from 9 Dec 2004 that discusses it & gives an example.)

Hope this helps
Jay
"RickPowell" <Ri********@discussions.microsoft.com> wrote in message
news:BB**********************************@microsof t.com...
I wrote a VB .NET Service to restart the computer when certain business
rules
are triggered (such as not being rebooted in x days, no users logged on,
time
is 1-3 am, etc.).

I am currently using a sloppy technique of checking the Registry to
determine if and who is logged on.

I would like to use a Microsoft sanctioned best-practice method of
determining if anyone is logged on (and their Username and all Process
Names
that the User is running, etc.) from the Service. It will run on XP Pro,
but
eventually Server 2003, etc.

I think I should be using the WindowStation and Desktop related API
calls,
but cannot find good documentation on how to do it from Visual Basic .NET
and
the proper sequence. I need some code snippets for something like,
EnumDesktops(), OpenWindowStation(), etc.

Any help from Microsoft ? (or anyone else that has done this).

Jul 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: FLEB | last post by:
I'm working on a logon system, something generic and modular, as a part of a few ideas I have running. I'm just wondering, though, what is the best way to keep a user logged in authentically...
15
by: Joshua Beall | last post by:
Hi All, What is the best way to use a cookie to remember a logged in user? Would you store the username and password in two separate cookies? Should the password be plain text? Hashed? Not...
1
by: Mike Moore | last post by:
Does anyone have suggestions on the best way to check if a user is logged into asp.net web application? We are not using forms authentication. We are authenticating our users against active...
0
by: Marty Cruise | last post by:
I have a Windows Forms application that accesses an SQL Server DB. I would like to show a 'Messenger-like' listing of all users, and which of them are currently logged in to the system. How can I...
16
by: Jm | last post by:
Hi All Is it possible to determine who is logged onto a machine from inside a service using code in vb.net ? I have found some code that seems to work under vb6, but doesnt under .NET ? Any help...
2
by: RickPowell | last post by:
I wrote a VB .NET Service to restart the computer when certain business rules are triggered (such as not being rebooted in x days, no users logged on, time is 1-3 am, etc.). I am currently using...
40
by: Jeff | last post by:
I have a system on a network and want to determine if anyone is currently connected to the back-end files. An interesting twist is that I have noticed that some users can be connected (have the...
3
by: =?Utf-8?B?aXdkdTE1?= | last post by:
Hi, im creating an application that will keep track of what users are logged into a network at a given time. all users must sign ingo this network first, so whenever a user is logged on, i will be...
5
by: Benedictum | last post by:
I need to implement an option to display on the web page for users currently logged in. How do I implement this in ASP.NET (c#). I could probably have a boolean field in the database where a user...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.