?
Solved

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

Posted on 2005-03-09
13
Medium Priority
?
327 Views
Last Modified: 2012-08-13
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
Comment
Question by:ramrod1979
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3
  • 2
13 Comments
 
LVL 27

Expert Comment

by:Tolomir
ID: 13496070
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
 
LVL 6

Expert Comment

by:Wallsy
ID: 13497318
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
 
LVL 27

Expert Comment

by:Tolomir
ID: 13498920
@ 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
Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

 
LVL 6

Expert Comment

by:Wallsy
ID: 13509317
Thanks Tolomir,

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

Cheers,

Wallsy
0
 

Author Comment

by:ramrod1979
ID: 13533906
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
 
LVL 27

Expert Comment

by:Tolomir
ID: 13534015
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
 
LVL 27

Expert Comment

by:Tolomir
ID: 13534190
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
 
LVL 27

Accepted Solution

by:
Tolomir earned 375 total points
ID: 13534246
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
 
LVL 6

Expert Comment

by:Wallsy
ID: 13534773
Yeah, I meant to say all that stuff too! But the batch file was as far as I got...

:)

Wallsy
0
 

Author Comment

by:ramrod1979
ID: 13563377
..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
 
LVL 27

Expert Comment

by:Tolomir
ID: 13563407
ok, thank you
0

Featured Post

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In a recent article here at Experts Exchange (http://www.experts-exchange.com/articles/18880/PaperPort-14-in-Windows-10-A-First-Look.html), I discussed my nine-month sandbox testing of the Windows 10 Technical Preview, specifically with respect to r…
#Citrix #POC #XenDesktop #vCenter #VMware #ESX
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question