• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 335
  • Last Modified:

Force user to close application before shutting down or logging off the system

Hi

How can I force users on the netwoek to close a running application before they shutdown or log off the pc? The network is a windows 2000 active directory enabled with clients running windows xp. This has become quite important because we run a bespoke application that gets corrupted transactions because despite constant warnings users do not bother to close down the running application properly and just go to start --> shutdown. Is there a script or something that can do this??? Also to be able to display a warning message would be very helpful.

Many thanks
0
ramrod1979
Asked:
ramrod1979
  • 6
  • 3
  • 2
1 Solution
 
TolomirAdministratorCommented:
First open gpedit.msc and drill down to either

Local Computer Policy|Windows Settings|Scripts (Startup/Shutdown) (this to be used for a shutdown script)
or
User Configuration|Windows Settings|Scripts (Logon/Logoff) (this to be used if you want to do this on changing users)

then click on Shutdown and add the link to your message like "notepad c:\path\warning.txt"

Right here you could add a program stopper too.

Tolomir
0
 
WallsyCommented:
I think that putting warning info in the logoff and shutdown scripts may be a little too late - but I'm only spouting off the top of my head here.

My idea would be to remove the shutdown and logoff buttons by policy, and replace them with shortcuts to a vbscript or batch file. The batch file could do something like:
(WARNING: This is VAPORWARE!!!)

tasklist | find /i "yourapp.exe"
if errorlevel 1 goto :notloaded
Echo You haven't exited yourapp!
Pause
Goto :EOF

:notloaded
REM Logoff
shutdown -l -f
REM OR Shutdown
shutdown -s -f

I'm sure you could do the same in VBScript fairly easily.

HTH,

Wallsy
0
 
TolomirAdministratorCommented:
@ Wallsy, yep you are right with the warning, my mousewheel was broken I had to fix that.

Then a used printer arrived, to replace my broken one, well I messed that up too.

Now the "new" is working again, since they are both the same modell, I try to repair the older too (in the meantime they  both showed the same failure), so this looks promissing.

Ok enough excuses.

You got a nice idea with this script.

 
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
WallsyCommented:
Thanks Tolomir,

I've just had a "nothing went right" day, so I empathise!

Cheers,

Wallsy
0
 
ramrod1979Author Commented:
Tolomir while I can appreciate that you may have certain issues with other aspects of your computing setup there is no need to hijack the question and have a personal conversation over the top of a question. Can you just not send wallsy your e-mail address or messenger id and talk that way?? Please don't do this!!??
0
 
TolomirAdministratorCommented:
Ramrod1979, I haven't tried to hijack your question, but had little time to respond.

Up today, I still cannot suggest more to you than to follow Wallsy's idea:

"Ok enough excuses. You got a nice idea with this script."

So you should try it that way.

1st: disable the logoff button
2nd: create a icon shortcut to a batchfile, that checks if that particual application is still running, if yes: Show a Warning message, if not (i.e. program is already closed) shutdown properly.

I don't think you have to use a vbscript, but a simple batchfile would be enough.

All you have to do is to replace "yourapp.exe" with the real name of the program, save the script in a front directory like c:\windows as shutdown.cmd

just start cmd.exe (from Start->run) and try to run the script.

c:\windows\shutdown.cmd <Enter>

Tolomir
0
 
TolomirAdministratorCommented:
http://www.windowsnetworking.com/kbase/WindowsTips/WindowsNT/RegistryTips/Disable/DisableLogoffbuttons..html

 Disable logoff buttons of Start menu and NT security dialog (alt-cntl-del).

Hive: HKEY_CURRENT_USER
Key: Software\Microsoft\Windows\CurrentVersion\Policies\Explorer
Name: NoLogoff
Type: REG_DWORD
Value: 1 disable

---
Save this to a "nologoff.reg"

<<<<<<<<cut here>>>>>>>>>>>>>>
Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer]
"NoLogoff"=dword:00000001
<<<<<<<<cut here>>>>>>>>>>>>>>


Has to be run once by each user (put it in autostart)
0
 
TolomirAdministratorCommented:
This looks a bit more comfortable:

http://support.microsoft.com/kb/292504/EN-US/

Policy Settings for the Start Menu in Windows XP

You can use the Group Policy editor (Gpedit.msc) under the following location to configure Start menu features:
User Configuration \ Administrative Templates \ Start Menu and Taskbar
Note: Except when noted, all of these registry settings are under the following registry key:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer
The registry entries are DWORD values. A value of 1 is enabled, and a value of 0 is disabled.


Policy:Disable Logoff on the Start Menu
Description:Removes the "Logoff" button from the Start menu and prevents
users from adding the Logoff button to the Start menu.
Registry Value:"StartMenuLogoff"

Policy:Disable and remove the Turn Off Computer button
Description:Removes the "Turn Off Computer" button from the Start Menu and
prevents shutting down Windows using the standard shutdown user interface.
Registry Value:"NoClose"

0
 
WallsyCommented:
Yeah, I meant to say all that stuff too! But the batch file was as far as I got...

:)

Wallsy
0
 
ramrod1979Author Commented:
..apologies about that. The last comment from Tolomir was more helpful. Many thanks Tolomir and I did not mean to be so horrible. Have a great day.

-ramrod
0
 
TolomirAdministratorCommented:
ok, thank you
0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

  • 6
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now