CJ Greiner Posted April 20, 2008 Posted April 20, 2008 I'm guessing that others have been in this situation too, and have probably already written programs to accomplish this: We have shared computers at work and when the previous shift leaves, they sometimes forget to log off and the screensaver leaves the computer locked. Holding down the "off" button to kill the computer's power isn't a very good way to get control of the computer... That seems like a good way to end up with a corrupted hard drive. I already have scripts on these computers for other purposes... I'd love to add a section of code that monitors for a key combination while the screensaver is running, and then log off the user smoothly so the next shift can log on. Thoughts? Ideas? Already-posted scripts that I missed in my search? Thanks,
Distrophy Posted April 20, 2008 Posted April 20, 2008 (edited) 1. Call your IT department. 2. Remove the password entirely, what is the point of having a password if anyone can unlock it. 3. If you are worried about outsiders gaining access, give everyone the same password. There are security measures for a reason. Edit: I should add, if you press the power button once, instead of holding it down, it should perform a soft shutdown. All their unsaved docs will be gone but that is what happens when you leave your computer locked for other shifts. Edited April 20, 2008 by Distrophy
CJ Greiner Posted April 21, 2008 Author Posted April 21, 2008 Thanks for the reply... perhaps I should be more clear: We want to maintain our individual logins and the associated tracking and security associated with them. We do have some computers with shared usernames/passwords, but those are strictly non-networked and for use as Data Entry terminals for our equipment. What we're hoping to do is to add a component to our regular monitoring and shortcuts software that will allow us to "soften the blow" of having to kill power to the machine just to be able to use it again. Pushing the power button to perform a soft shutdown only works on a small number of our machines. It's not as good as just forcing a logoff, but it's better than the hard shutdown that most of our machines have to endure. We try to get users to log off every time they leave the computer, but there are those that forget... and thus the reason for my original request. I was hoping that maybe someone had worked on something like this, and I just wasn't able to find it using the forum search... Thanks,
redsleeves Posted April 21, 2008 Posted April 21, 2008 Maybe this will be helpful:http://www.robvanderwoude.com/files/logoff_vbs.txtexpandcollapse popup' Logoff.vbs, Version 1.00 ' Logoff current user on any WMI enabled computer on the network ' ' Adapted from posts by Alex Angelopoulos on www.developersdex.com ' and Michael Harris on microsoft.public.scripting.vbscript ' ' Written by Rob van der Woude ' http://www.robvanderwoude.com ' Check command line parameters Select Case WScript.Arguments.Count Case 0 ' Default is local computer if none specified strComputer = "." Case 1 Select Case WScript.Arguments(0) ' "?", "-?" or "/?" invoke online help Case "?" Syntax Case "-?" Syntax Case "/?" Syntax Case Else strComputer = WScript.Arguments(0) End Select Case Else ' More than 1 argument is not allowed Syntax End Select ' Define some constants that can be used in this script; ' logoff = 0 (no forced close of applications) or 5 (forced); ' 5 works OK in Windows 2000, but may result in power off in XP Const EWX_LOGOFF = 0 Const EWX_SHUTDOWN = 1 Const EWX_REBOOT = 2 Const EWX_FORCE = 4 Const EWX_POWEROFF = 8 ' Connect to computer Set OpSysSet = GetObject("winmgmts:{(Shutdown)}//" & strComputer & "/root/cimv2").ExecQuery("select * from Win32_OperatingSystem where Primary=true") ' Actual logoff for each OpSys in OpSysSet OpSys.Win32Shutdown EWX_LOGOFF next ' Done WScript.Quit(0) Sub Syntax msg = vbCrLf & "Logoff.vbs, Version 1.00" & vbCrLf & _ "Logoff the current user of any WMI enabled computer on the network." & _ vbCrLf & vbCrLf & "Usage: CSCRIPT LOGOFF.VBS [ computer_name ]" & _ vbCrLf & vbCrLf & _ "Where: " & Chr(34) & "computer_name" & Chr(34) & _ " is the name of the computer to be logged off" & vbCrLf & _ " (without leading backslashes); default is " & _ Chr(34) & "." & Chr(34) & vbCrLf & _ " (the local computer)." & vbCrLf & vbCrLf & _ "Written by Rob van der Woude" & vbCrLf & _ "http://www.robvanderwoude.com" & vbCrLf & vbCrLf & _ "Based on posts by Alex Angelopoulos on www.developersdex.com" & _ vbCrLf & _ "and Michael Harris on microsoft.public.scripting.vbscript" & vbCrLf Wscript.Echo(msg) Wscript.Quit(1) End Sub
FreeFry Posted April 21, 2008 Posted April 21, 2008 Maybe you could tell your it-department to have a look at the group policy editor in windows(start > run > type gpedit.msc), in there you can define so that users are automatically logged off when their login-time runs out. Otherwise(with autoit), you could perhaps detect when the screensaver is active/running, and then log the user off(or alternative, start a timer, and wait for some time(like.. 30 minuts or something), then log the user off.
CJ Greiner Posted April 22, 2008 Author Posted April 22, 2008 Thanks redsleeves -- I'll have to see if there's a useful way to implement that code.______________Maybe you could tell your it-department to have a look at the group policy editor in windows(start > run > type gpedit.msc), in there you can define so that users are automatically logged off when their login-time runs out.Otherwise(with autoit), you could perhaps detect when the screensaver is active/running, and then log the user off(or alternative, start a timer, and wait for some time(like.. 30 minutes or something), then log the user off.I've already taken a look at the timeout method -- and I like it for some of our computers where I'm pretty sure the users who leave it locked aren't working on anything important. In that case, it could time out at 30 minutes and log off any time without much consequence.For the ones that I only want to log off after their shift, it gets a little harder. We're on rotating shifts, so I can't really assign users to shifts then log them off on a timer after their shift. I could probably go into more sophisticated logging that tracks their most recent login activity and deduces what shift they're on, then timeout after the end of their shift...OR, if we can figure out how to use a key combination that wouldn't force the computer to the login screen, but instead trigger the code to log off the computer, then we'd be all set!Thanks,
FreeFry Posted April 22, 2008 Posted April 22, 2008 (edited) When you say the computer is locked, do you mean it's locked by the screensaver? If that's the case, you should fairly easily be able to make a script that logs them off: HotKeySet("^+l", "_LogOut") While 1 Sleep(1000) WEnd Func _LogOut() ShutDown(0) ; Logs out. EndFunc To clarify my other suggestion:wait for the screensaver to start, then start a timer(for 30 minutes, perhaps?), and if no input(mouse/keyboard) is done in those 30 mins, then log them off(to prevent logging someone who's just away for a few mins). Edited April 22, 2008 by FreeFry
Bert Posted April 22, 2008 Posted April 22, 2008 I forget where I saw this, but Microsoft has a screensaver that you can set to log off a user if they have the screensaver up too long. That would solve the problem. The Vollatran project My blog: http://www.vollysinterestingshit.com/
Bert Posted April 22, 2008 Posted April 22, 2008 http://support.microsoft.com/kb/314999 The Vollatran project My blog: http://www.vollysinterestingshit.com/
CJ Greiner Posted April 23, 2008 Author Posted April 23, 2008 Those are some great links & good info. I'll try them out -- I'll let you know what I end up using. Thanks,
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