link470 Posted April 8, 2009 Posted April 8, 2009 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!
DAckroyd Posted April 8, 2009 Posted April 8, 2009 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?
mac_shinobi Posted April 8, 2009 Posted April 8, 2009 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.
jamesb Posted April 8, 2009 Posted April 8, 2009 If you start the games through a batch file instead you could use the following: start /wait "C:\Games\Starcraft.exe" shutdown /l 1
DAckroyd Posted April 8, 2009 Posted April 8, 2009 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?
jamesb Posted April 8, 2009 Posted April 8, 2009 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.
srochford Posted April 8, 2009 Posted April 8, 2009 VBS would be: 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: sCmd="shutdown /l" oShell.run sCmd you then run this with "wscript " (you want wscript otherwise a cscript window will lurk in the background)
SYNACK Posted April 8, 2009 Posted April 8, 2009 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.
matt40k Posted April 8, 2009 Posted April 8, 2009 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
mac_shinobi Posted April 8, 2009 Posted April 8, 2009 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 ?
link470 Posted April 8, 2009 Author Posted April 8, 2009 (edited) 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! Edited April 8, 2009 by link470
SYNACK Posted April 8, 2009 Posted April 8, 2009 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...
link470 Posted April 8, 2009 Author Posted April 8, 2009 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.
SYNACK Posted April 8, 2009 Posted April 8, 2009 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.
link470 Posted April 9, 2009 Author Posted April 9, 2009 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!
SYNACK Posted April 9, 2009 Posted April 9, 2009 If you want to edit the reg after the change you can simple load up the user.dat reg file from the game users profile in regedit and change it from within the administrator account.
link470 Posted April 9, 2009 Author Posted April 9, 2009 If you want to edit the reg after the change you can simple load up the user.dat reg file from the game users profile in regedit and change it from within the administrator account. Awesome. Never done that attempt before, I'll give that a shot, thanks! And ya I ended up disabling the screensaver on that account or setting the value to 1 in regedit if I want to do maintenance. So at the moment it's 1, then I'll hide it again later when the consoles actually ready. Thanks guys! I'll let you know how it goes. Next steps are to install the games, make sure the logging on and logging off work seamlessly with the game start and quit, and then test imaging.
link470 Posted April 10, 2009 Author Posted April 10, 2009 (edited) Hmm, I'd really like to use the User Shell idea, but I think VB may be what I have to go with. I set the game as the user shell and the game doesn't run, and gives the error "could not initialize graphics system. make sure that your video card and driver are compatible with directdraw". As soon as I CTRL+ALT+DEL and run Explorer, select the game from the start menu, it launches fine. Must be dependant on something in explorer...unless I'm missing something. Also, after that error, it doesn't log me back out. Maybe I have to quit the game properly to log out, but at the moment since I'm getting the error I have to CTRL+ALT+DEL and choose log out from the task manager Shut Down menu. Any suggestions? If not I'll try VB next. Thanks! ::EDIT:: Just tried with Starcraft, same thing. They both give errors related to being unable to change video settings when they're set as User Shell. As soon as you start up Explorer.exe and then launch the game, it works perfectly. Starcrafts specific error has lots of information on changing screen resolution etc. or updating DirectX, which isn't what we need of course. But it lists the specific error if that helps. The error encountered while trying to switch video modes was: Not implemented vidinimo_PC.cpp line 160 SetDisplayMode Sounds like it's calling for something required in explorer? No idea really. About to try VB. Let me know if you have any ideas for the user shell! That would be my preference if possible since it's near tamper proof for the average user. Thanks so much. ::EDIT:: VB error on line 3 char 1. Argument not optional: 'oShell.run' Code 800A01C1 Edited April 11, 2009 by link470
link470 Posted April 15, 2009 Author Posted April 15, 2009 Hey guys! I haven't found anything else yet that would do a better job than what you all have suggested. Anything ideas on fixing the user shell error or the VB script, or any other ideas? I've still got 2 weeks. Thanks!
SYNACK Posted April 16, 2009 Posted April 16, 2009 What is the full VBS code that you are having issues with? It looks like lots of the stuff is implemented through explorer now which was not the case back in win 98 which was the last time that I used this type of method. The other option would be to try a cut down shell replacement set to start the program, possibly one of there: [ame=http://en.wikipedia.org/wiki/Windows_shell_replacement]Windows shell replacement - Wikipedia, the free encyclopedia[/ame]
link470 Posted April 16, 2009 Author Posted April 16, 2009 What is the full VBS code that you are having issues with? I was using the VB script mentioned earlier on the first page of this thread. VBS would be: 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: sCmd="shutdown /l" oShell.run sCmd you then run this with "wscript " (you want wscript otherwise a cscript window will lurk in the background) So that's what I did, and this is the exact code I have that generates that error: set oShell=createobject("wscript.shell") sCmd="C:\Program Files\Microsoft Games\Age of Empires II\EMPIRES2.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 sCmd="shutdown /l" oShell.run sCmd
SYNACK Posted April 16, 2009 Posted April 16, 2009 I was using the VB script mentioned earlier on the first page of this thread. So that's what I did, and this is the exact code I have that generates that error: Your missing a few bits in the code and have some extra, try this: set oShell=createobject("wscript.shell") sCmd="C:\Program Files\Microsoft Games\Age of Empires II\EMPIRES2.EXE" oShell.run [color=red]sCmd,1,[/color]true 'true forces it to wait for process to finish sCmd="shutdown /l" oShell.run sCmd
link470 Posted April 17, 2009 Author Posted April 17, 2009 Your missing a few bits in the code and have some extra, try this: set oShell=createobject("wscript.shell") sCmd="C:\Program Files\Microsoft Games\Age of Empires II\EMPIRES2.EXE" oShell.run [color=red]sCmd,1,[/color]true 'true forces it to wait for process to finish sCmd="shutdown /l" oShell.run sCmd Hmm, I'm getting an error on Line 3 character 1, the system cannot find the specified file.
SYNACK Posted April 17, 2009 Posted April 17, 2009 Are you sure that the file is there and that the user has read access to it? Try it with notepad just to make sure: sCmd="notepad.EXE"
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