John117 Posted July 19, 2007 Share Posted July 19, 2007 I have a GUI that I have been working on and before finishing it, I need a way to tell if a user is logged on to their system. -moving the mouse, using the keyboard, anything . . . The GUI has a list of users and can send messages via net send to any of those users. Each will have the GUI. I need a way to display on the GUI if other users are logged on to their system. It will have to be intranet based. Sending stats to a webserver is not an option because of privacy concerns. I am open to any ideas or tips on how to do this. Other post refs are very welcome! Thanks Link to comment Share on other sites More sharing options...
PsaltyDS Posted July 19, 2007 Share Posted July 19, 2007 I have a GUI that I have been working on and before finishing it, I need a way to tell if a user is logged on to their system. -moving the mouse, using the keyboard, anything . . . The GUI has a list of users and can send messages via net send to any of those users. Each will have the GUI. I need a way to display on the GUI if other users are logged on to their system.It will have to be intranet based. Sending stats to a webserver is not an option because of privacy concerns.I am open to any ideas or tips on how to do this. Other post refs are very welcome!Thanks This sounds like a GAIM-style chat application that indicates who else is online to talk to. The easiest way to handle that is to have the client on each workstation send status to a central server (on the LAN, not to an external site, as you indicated). The server side can accept "online" status from the client, plus time out the client to "offline" if the client doesn't update its status periodically. So:1. Server side is running, keeps list of online clients2. Client comes up and requests online user list from server3. Server notes that client is online and adds to list4. Server notes time of last status request from this client5. Server replies with complete list of clients online6. Client presents user with list of other clients.7. Client periodically requests updated list from server8. Server periodically checks time since last status request from each client and removes from list if timeout Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
ptrex Posted July 19, 2007 Share Posted July 19, 2007 @all This will show the logged on user. expandcollapse popup#include <date.au3> $strComputer = "." $objWMIService = ObjGet("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & $strComputer & "\root\cimv2") $colItems = $objWMIService.ExecQuery _ ("Select * from Win32_NetworkLoginProfile where AuthorizationFlags = 4") For $objItem in $colItems $dtmWMIDate = $objItem.AccountExpires $strReturn = WMIDateStringToDate($dtmWMIDate) Consolewrite ("Account Expires: " & $strReturn & @CR) Consolewrite ("Authorization Flags: " & $objItem.AuthorizationFlags & @CR) Consolewrite ("Bad Password Count: " & $objItem.BadPasswordCount & @CR) Consolewrite ("Caption: " & $objItem.Caption & @CR) Consolewrite ("CodePage: " & $objItem.CodePage & @CR) Consolewrite ("Comment: " & $objItem.Comment & @CR) Consolewrite ("Country Code: " & $objItem.CountryCode & @CR) Consolewrite ("Description: " & $objItem.Description & @CR) Consolewrite ("Flags: " & $objItem.Flags & @CR) Consolewrite ("Full Name: " & $objItem.FullName & @CR) Consolewrite ("Home Directory: " & $objItem.HomeDirectory & @CR) Consolewrite ("Home Directory Drive: " & $objItem.HomeDirectoryDrive & @CR) $dtmWMIDate = $objItem.LastLogoff $strReturn = WMIDateStringToDate($dtmWMIDate) Consolewrite ("Last Logoff: " & $strReturn & @CR) $dtmWMIDate = $objItem.LastLogon $strReturn = WMIDateStringToDate($dtmWMIDate) Consolewrite ("Last Logon: " & $strReturn & @CR) Consolewrite ("Logon Hours: " & $objItem.LogonHours & @CR) Consolewrite ("Logon Server: " & $objItem.LogonServer & @CR) Consolewrite ("Maximum Storage: " & $objItem.MaximumStorage & @CR) Consolewrite ("Name: " & $objItem.Name & @CR) Consolewrite ("Number Of Logons: " & $objItem.NumberOfLogons & @CR) Consolewrite ("Password Age: " & $objItem.PasswordAge & @CR) $dtmWMIDate = $objItem.PasswordExpires $strReturn = WMIDateStringToDate($dtmWMIDate) Consolewrite ("Password Expires: " & $strReturn & @CR) Consolewrite ("Primary Group ID: " & $objItem.PrimaryGroupId & @CR) Consolewrite ("Privileges: " & $objItem.Privileges & @CR) Consolewrite ("Profile: " & $objItem.Profile & @CR) Consolewrite ("Script Path: " & $objItem.ScriptPath & @CR) Consolewrite ("Setting ID: " & $objItem.SettingID & @CR) Consolewrite ("Units Per Week: " & $objItem.UnitsPerWeek & @CR) Consolewrite ("User Comment: " & $objItem.UserComment & @CR) Consolewrite ("User Id: " & $objItem.UserId & @CR) Consolewrite ("User Type: " & $objItem.UserType & @CR) Consolewrite ("Workstations: " & $objItem.Workstations & @CR) Consolewrite ("----------------"& @CR) Next Func WMIDateStringToDate($dtmWMIDate) Local $Return If Not $dtmWMIDate ="" Then Return (StringMid($dtmWMIDate, 5, 2) & "/" & _ StringMid($dtmWMIDate, 7, 2) & "/" & StringLeft($dtmWMIDate, 4) _ & " " & StringMid($dtmWMIDate, 9, 2) & ":" & StringMid($dtmWMIDate, 11, 2) & ":" & StringMid($dtmWMIDate,13, 2)) Return $Return Endif EndFunc The output can easily be outputted in an HTML file on an Intranet. regards, ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
PsaltyDS Posted July 19, 2007 Share Posted July 19, 2007 @allThis will show the logged on user. The output can easily be outputted in an HTML file on an Intranet.regards,ptrexGood stuff, but I think it's overkill for the IM app the OP seems to be implementing. Doesn't look like administrative logging of user details is the point. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
John117 Posted July 19, 2007 Author Share Posted July 19, 2007 ptrex -thanks! I'll most likely be grabbing several snippits from this as I build my version! PsaltyDS -Thanks again, as always! -looks like good path! Link to comment Share on other sites More sharing options...
John117 Posted July 19, 2007 Author Share Posted July 19, 2007 (edited) This sounds like a GAIM-style chat application that indicates who else is online to talk to. The easiest way to handle that is to have the client on each workstation send status to a central server (on the LAN, not to an external site, as you indicated). The server side can accept "online" status from the client, plus time out the client to "offline" if the client doesn't update its status periodically. So:1. Server side is running, keeps list of online clients2. Client comes up and requests online user list from server3. Server notes that client is online and adds to list4. Server notes time of last status request from this client5. Server replies with complete list of clients online6. Client presents user with list of other clients.7. Client periodically requests updated list from server8. Server periodically checks time since last status request from each client and removes from list if timeout I like the idea of using a file on the lan. Gonna run something by you just to see if you think it would work.I would like to have a file placed on the lan. A database, or any other easy to work solution where a table exsists with fields:USERID (PC Logon)Actual name (Display Name pulled back to GUI)Two skill fieldsone log on time fieldone log off time field.A user would open the GUIThe GUI connects to the file and searches the table for The USERID. -If found, it adds a logon time for the user and pulls all other users with a time X minutes less from now() where Logon is greater than LogoffIf userid Is not found it opens a second input GUI for the record to add to the table.The GUI would requery the file every x the GUI is open. Before close, the GUI would send Log off time.Sound like it would work? would this be slow? Thanks for any help! Edited July 19, 2007 by Hatcheda Link to comment Share on other sites More sharing options...
PsaltyDS Posted July 19, 2007 Share Posted July 19, 2007 I like the idea of using a file on the lan. Gonna run something by you just to see if you think it would work.I would like to have a file placed on the lan. A database, or any other easy to work solution where a table exsists with fields:USERID (PC Logon)Actual name (Display Name pulled back to GUI)Two skill fieldsone log on time fieldone log off time field.A user would open the GUIThe GUI connects to the file and searches the table for The USERID. -If found, it adds a logon time for the user and pulls all other users with a time X minutes less from now() where Logon is greater than LogoffIf userid Is not found it opens a second input GUI for the record to add to the table.The GUI would requery the file every x the GUI is open. Before close, the GUI would send Log off time.Sound like it would work? would this be slow? Thanks for any help!The answer depends on how much you want to 'manage' this. If it is only going to be used by authenticated users that have successfully logged on to managed workstations in an AD domain, then just a file in a share is enough. Give authenticated users write perms to the file (maybe an SQLite Data.db) and leave it to your client script on each workstation to behave itself. GUIs and management processes for adding/deleting users are not required. Each client adds itself or updates its own "last seen" time. Each client reads the rest of the user's status from the same place. Each client changes its own status to "offline" when closing.For a basic IM app that's all you need.Now, if you are going to start 'managing' things, you have to state clearly what you need. Is this really just to log user activity, track over-long coffee breaks, initiate disciplinary actions, etc.? Then you have to make it secure against user spoofing/tampering/etc. and the answers get long, complicated, and legalistic. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
John117 Posted July 19, 2007 Author Share Posted July 19, 2007 (edited) na, its just gonna be used for help with specific questions. 'you get a question you can't handle' = you see who's logged on and what skill then you im them for help. I wouldn't want to im an empty cube and expect it to whip up a answer very quickly As far as the tight logging jiberish, we already have that! but thats another story. All passwords and names are pulled down from the domain, so there will be no faking who's who. Plus I will be locking up the source and not giving the path past sup/mrg level. "So whos to say where the file is . . ." -could apply password access and place it in the source code aswell.I grabbed a bit of Access code earlier. I know nothing about SQL but have been needing to work with it. Do you suppose it woud be easier to work with since all code will be ground up so to speak? does autoit talk SQL easier?Some good Access code:http://www.autoitscript.com/forum/index.ph...mp;#entry230946 Edited July 19, 2007 by Hatcheda Link to comment Share on other sites More sharing options...
PsaltyDS Posted July 19, 2007 Share Posted July 19, 2007 I don't think an Access file gives you multiple access.AutoIt has UDF include files for using SQLite, and I think it's you best option, if have a little time to learn something new and very useful. Check out the web site for SQLite to learn more, and check the AutoIt help file for the _SQL* functions to see how it's done. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
John117 Posted July 19, 2007 Author Share Posted July 19, 2007 I don't think an Access file gives you multiple access.AutoIt has UDF include files for using SQLite, and I think it's you best option, if have a little time to learn something new and very useful. Check out the web site for SQLite to learn more, and check the AutoIt help file for the _SQL* functions to see how it's done. Hey! Thanks for the input! Access does offer multiple access. I am very heavy on excel pulls and pushes from a lan based Access dbI have never played around with SQLite and was thinking from all the posts that it would be easier. Thanks for the link and input. I think I will be learning SQL now! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now