Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / General / January 2005

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
RickPowell - 07 Jan 2005 20:25 GMT
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).
dotNetDave - 11 Jan 2005 00:41 GMT
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

> 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
[quoted text clipped - 14 lines]
>
> Any help from Microsoft ?  (or anyone else that has done this).
Jay B. Harlow [MVP - Outlook] - 11 Jan 2005 04:14 GMT
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/microsoft.public.dotnet.languages.vb/browse_
thread/thread/3db76e966926c29e/30d390cf3dc29eec?q=netwkstauserenum+group:microso
ft.public.dotnet.*&_done=%2Fgroups%3Fas_q%3Dnetwkstauserenum%26num%3D10%26scorin
g%3Dr%26hl%3Den%26ie%3DUTF-8%26as_epq%3D%26as_oq%3D%26as_eq%3D%26as_ugroup%3Dmic
rosoft.public.dotnet.*%26as_usubject%3D%26as_uauthors%3D%26lr%3D%26as_drrb%3Dq%2
6as_qdr%3D%26as_mind%3D1%26as_minm%3D1%26as_miny%3D1981%26as_maxd%3D10%26as_maxm
%3D1%26as_maxy%3D1981%26safe%3Doff%26&_doneTitle=Back+to+Search&&d#30d390cf3dc29
eec


(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
>I wrote a VB .NET Service to restart the computer when certain business
>rules
[quoted text clipped - 20 lines]
>
> Any help from Microsoft ?  (or anyone else that has done this).

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.