+ Post New Thread
Page 1 of 3 123 LastLast
Results 1 to 15 of 33
Windows Thread, Auto log off user after a program is closed in Technical; ...
  1. #1
    link470's Avatar
    Join Date
    Nov 2007
    Location
    Canada
    Posts
    252
    Thank Post
    86
    Thanked 8 Times in 6 Posts
    Rep Power
    15

    Auto log off user after a program is closed

    Alright so here's the deal. I'm building 8 machines. Windows XP Professional. Games like Starcraft, Warcraft, Age Of Empires etc. will be installed, so the machines are 1.8GHz, 256MB of ram, and a 10GB HD. Yes, it's what I had lying around lol. So I'm building these as console systems, they aren't connected to a domain, and once configured they will be frozen with Deepfreeze. They're using the Windows Welcome screen for logging in, each game has it's own useraccount within a very stripped down interface. So for example, click STARCRAFT user with a Starcraft icon as the user icon, and Starcraft launches since it will be in STARCRAFT's Startup folder. Sounds simple so far! I'd like to take it a step further. When the game is quit, no matter what game it is, can I have a script [I need your help ] that will log off the user and send them back to the Welcome screen? I don't need to prevent minimizing or anything like that, these aren't super secure machines. I'd just like the process to be as smooth as possible. So here's what'll happen.

    •User powers up machine
    •Welcome screen appears
    •User selects game [user account]
    •[User account logs in] Game starts
    •User closes game or chooses quit [user account logs off and sends user back to welcome screen]

    That last bracket is what I need help with. Any ideas? Thanks so much in advance!

  2. #2

    Join Date
    Feb 2009
    Posts
    460
    Thank Post
    66
    Thanked 34 Times in 21 Posts
    Blog Entries
    1
    Rep Power
    19
    I think what you need if I'm thinking correctly is a .bat file which opens the game and sits in the background and waits for the program to exit then detects the close (I'm not an expert in this sort of thing)

    Have found this that might help in the mean time Hey, Scripting Guy! How Can I Log a User Off After 5 Minutes of Inactivity?

  3. #3

    mac_shinobi's Avatar
    Join Date
    Aug 2005
    Posts
    9,896
    Thank Post
    3,418
    Thanked 1,081 Times in 997 Posts
    Rep Power
    369
    You can use vbscript and use WMI to monitor for the process name using win32_process and when the process for the game ends force a logout which will take them back to the welcome screen.

    Dont have time to post an example but will check back later and see if srochford or someone else has posted back.

  4. #4

    Join Date
    Mar 2008
    Location
    Surrey
    Posts
    2,209
    Thank Post
    114
    Thanked 331 Times in 273 Posts
    Blog Entries
    4
    Rep Power
    115
    If you start the games through a batch file instead you could use the following:

    Code:
     
    start /wait "C:\Games\Starcraft.exe"
    shutdown /l

  5. #5

    Join Date
    Feb 2009
    Posts
    460
    Thank Post
    66
    Thanked 34 Times in 21 Posts
    Blog Entries
    1
    Rep Power
    19
    that looks too simple!!! run that batch file from the logon script and your sorted!

    James: Will this only work as a batch file or will a VBS do it also?

  6. #6

    Join Date
    Mar 2008
    Location
    Surrey
    Posts
    2,209
    Thank Post
    114
    Thanked 331 Times in 273 Posts
    Blog Entries
    4
    Rep Power
    115
    All it is, is a couple of cmd-line commands.

    The first one starts a program, then pauses the batch until that program closes.

    The second one forces a logoff.

    I love simple solutions. I'm not sure whether or not you could do something similar in VBS, but I'd be very suprised if you couldn't.

  7. #7

    Join Date
    Aug 2005
    Location
    London
    Posts
    3,157
    Thank Post
    116
    Thanked 529 Times in 452 Posts
    Blog Entries
    2
    Rep Power
    124
    VBS would be:
    Code:
    set oShell=createobject("wscript.shell")
    sCmd="C:\Games\Starcraft.exe"
    oShell.run,,true 'true forces it to wait for process to finish
    Set OpSystems = GetObject("winmgmts:{(Shutdown)}//./root/cimv2").ExecQuery("select * from Win32_OperatingSystem where Primary=true")
    
    for each OpSys in OpSystems
    	OpSys.Win32Shutdown 0
    next
    the WMI stuff to log off is a bit of overkill - you could just do:
    Code:
    sCmd="shutdown /l"
    oShell.run sCmd
    you then run this with "wscript <name of vbscriptfile>" (you want wscript otherwise a cscript window will lurk in the background)

  8. #8

    SYNACK's Avatar
    Join Date
    Oct 2007
    Posts
    11,239
    Thank Post
    882
    Thanked 2,742 Times in 2,316 Posts
    Blog Entries
    11
    Rep Power
    784
    Why not just change the shell application of each different user to be the game itself. That way only the game loads and when they quit it logs out, no scripting nessisary:

    How To Change The Windows Xp Shell.

    It also saves a few of those prescious CPU cycles and megabytes of RAM for the games themselves as explorer is not running in the background.

  9. #9

    matt40k's Avatar
    Join Date
    Jun 2008
    Location
    Ipswich
    Posts
    4,442
    Thank Post
    369
    Thanked 650 Times in 531 Posts
    Rep Power
    160
    Make a .exe with links to the programs then use a local gp to use a custom GUI

    User Configuration | Administrative Templates | System | Custom user interface

  10. #10

    mac_shinobi's Avatar
    Join Date
    Aug 2005
    Posts
    9,896
    Thank Post
    3,418
    Thanked 1,081 Times in 997 Posts
    Rep Power
    369
    Quote Originally Posted by SYNACK View Post
    Why not just change the shell application of each different user to be the game itself. That way only the game loads and when they quit it logs out, no scripting nessisary:

    How To Change The Windows Xp Shell.

    It also saves a few of those prescious CPU cycles and megabytes of RAM for the games themselves as explorer is not running in the background.
    This would be the easier option instead of scripting it all.

    When you do quit will it go to the welcome screen or will it just go to a blank screen ?

  11. #11
    link470's Avatar
    Join Date
    Nov 2007
    Location
    Canada
    Posts
    252
    Thank Post
    86
    Thanked 8 Times in 6 Posts
    Rep Power
    15
    These options are fantastic so far! Thanks guys! I'm thinking of the Windows Shell idea but I've got lots to play with at the moment! Thank you so much.

    I'm also interested in that last question, if it is the shell, will it force them to go back to welcome screen or will it just show a blank screen?

    ::EDIT::

    Also, while I'm here, what do you think is the best way to image these? They're not on a domain and I'd need to keep the accounts in tact since each account is a different configured game, would sysprep be able to do that? I mean, I'm almost thinking since they're identical to just do a straight disk to disk copy with Ghost and then change the name once the subsequent machines are booted up on each machine.

    Any suggestions?

    Thanks!
    Last edited by link470; 8th April 2009 at 05:06 PM.

  12. #12

    SYNACK's Avatar
    Join Date
    Oct 2007
    Posts
    11,239
    Thank Post
    882
    Thanked 2,742 Times in 2,316 Posts
    Blog Entries
    11
    Rep Power
    784
    When the game application ends it should return you to the logon screen as effectivly the host process for that user session has ended. If the computers are near identical you should be able to get away with a strait image and SID change (probably don't need the SID change but better safe). You could use any imageing tech to do this including Ghost, FOG, Clonzilla, DriveImage XML, WDS (without syspreping the image), Altris etc... etc...

  13. #13
    link470's Avatar
    Join Date
    Nov 2007
    Location
    Canada
    Posts
    252
    Thank Post
    86
    Thanked 8 Times in 6 Posts
    Rep Power
    15
    Awsome thanks! Another question, for making the game the shell, how can I make the shell different for every user on the system? Or do I need the shell to be a script that says if this user, use this shell [or game]. Anyone able to explain that quickly? Thank you so much.

  14. #14

    SYNACK's Avatar
    Join Date
    Oct 2007
    Posts
    11,239
    Thank Post
    882
    Thanked 2,742 Times in 2,316 Posts
    Blog Entries
    11
    Rep Power
    784
    You can just change it in the reg for each user:
    How To Change The Windows Xp Shell.
    Changing the default shell (only current user):

    1) open regedit (start menu > run, and type in regedit).
    2) go to: HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Winlogon.
    3) add a new string value (Edit > New > String Value) called shell. and set the value to the path of the new shell e.g C:\Litestep\litestep.exe.
    4) log out and log back in.

  15. #15
    link470's Avatar
    Join Date
    Nov 2007
    Location
    Canada
    Posts
    252
    Thank Post
    86
    Thanked 8 Times in 6 Posts
    Rep Power
    15
    Thank you all once again for your responses so far! Almost there!

    Two questions. When I change the shell of say, the Starcraft user, to starcraft.exe, how am I going to change it back since regedit will only do "current user". Starcraft won't give me access to the registry editor. In case I need to change anything I'd like to be able to edit it. Do I log in as Administrator and right click regedit.exe and Run As the Starcraft user?

    Second question, I've decided to hide the Administrator account so it's nice and clean and only shows the games on the welcome screen. Normally Administrator is hidden unless it's logged in in which case it's shown so you can click it to unlock your account, but Administrator shows up all the time now for some reason, not sure why. So what I decided to do was follow a tutorial to hide Administrator. That's fantastic, it worked. Double CTRL+ALT+DEL at the welcome screen to bring it up, the trouble is, if I lock that account or if I leave the screensaver on so when I shake the mouse it goes back to the welcome screen, the Administrator account is hidden still, AND CTRL+ALT+DEL doesn't work. So I have no choice but to use the Turn off computer link in the bottom left and log Administrator out and restart. Any suggestions? Thanks!

SHARE:
+ Post New Thread
Page 1 of 3 123 LastLast

Similar Threads

  1. Auto Defrag & Reducing User Profiles
    By shane-meh in forum Windows Server 2000/2003
    Replies: 10
    Last Post: 7th April 2009, 03:33 PM
  2. Auto log off
    By James2k in forum Windows
    Replies: 6
    Last Post: 3rd December 2008, 10:25 PM
  3. Permitting only one user to log on to a workstation
    By ctbjs in forum How do you do....it?
    Replies: 8
    Last Post: 5th September 2007, 03:27 PM
  4. Replies: 4
    Last Post: 12th July 2006, 09:59 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •