Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Script to run before Shut Down

18 Dec 2013   #1
bawldiggle

XP/7x32 & x64/8x64/8.1x64
 
 
Script to run before Shut Down

I have a script run by a shortcut to open a specific external HD.
If the HD is not connected shows my preferred message.
(Loops through all drives, to identify the HD unique ID)

How would I stage a script to run before Shut Down to capture the HD if it is still connected, and cancel Shut Down.

Is it possible ?

Would appreciate any help


My System SpecsSystem Spec
.
18 Dec 2013   #2
TanyaC

Linux Mint 17 Cinnamon | Win 7 Ult x64
 
 

Hi,

Have a look at this Technet link. Hopefully will tell you everything you need.

http://technet.microsoft.com/en-us/l.../cc770300.aspx

Tanya
My System SpecsSystem Spec
18 Dec 2013   #3
bawldiggle

XP/7x32 & x64/8x64/8.1x64
 
 

Thanks TanyaC for your response

I failed to tell you I am using Win7 Home Premium. Obviously no Group Policy.
-----
EDIT
-----
Just found ...
At Open the Local Group Policy Editor I found ...

Quote:
To open the Local Group Policy Editor as an MMC snap-in
  1. Open MMC. (Click Start , click in the Start Search box, type mmc , and then press ENTER .)
  2. On the File menu, click Add/Remove Snap-in .
  3. In the Add or Remove Snap-ins dialog box, click Group Policy Object Editor , and then click Add .
  4. In the Select Group Policy Object dialog box, click Browse .
  5. Click This computer to edit the Local Group Policy object, or click Users to edit Administrator, Non-Administrator, or per-user Local Group Policy objects.
  6. Click Finish .
Would this process enable me to run my script as planned -- OR AM I snookered with Home Premium ?
My System SpecsSystem Spec
.

19 Dec 2013   #4
TanyaC

Linux Mint 17 Cinnamon | Win 7 Ult x64
 
 

Hi,

Yes, this is another way to access the group policy editor, assuming the snap in is installed on Home Premium. All my computers were either professional or ultimate so I always had access to the GPO.

In any case, even if you cannot get access to the GP editor all is not lost, because for the most part it is simply an interface to the registry, and generally speaking mosst things you can do with GP Editor can be done with manual registry entries.

I found this example discussing how to do it via the registry.. (It is a bit technical), if you can't run the GPO from MMC and want have a go via the registry, make sure you back it up first, or at least create a restore point.

http://en.kioskea.net/faq/3358-execu...p-and-shutdown

(Credit to Kioskea.net for the code).

Get back to us if you need more help with this.

Edit: The only thing I'm not sure of is if Windows Home Premium will honour the scripts, but reading through the KioskEa.net solution , it certainly implies it will.

HTH
Tanya
My System SpecsSystem Spec
19 Dec 2013   #5
bawldiggle

XP/7x32 & x64/8x64/8.1x64
 
 

Thanks TanyaC,

So close to Xmas it will be a week or two before I can get to "my script" experiment.
I have been out of the country for about 8 weeks (not holidays) and my daughter is on my case to downgrade her Win8 Dell, to Win7.

I will get back here when I get the script working.

One question, can I suspend "Shut Down" with script or is shut-down inevitable.?
My System SpecsSystem Spec
19 Dec 2013   #6
TanyaC

Linux Mint 17 Cinnamon | Win 7 Ult x64
 
 

Quote   Quote: Originally Posted by GrayGhost2 View Post
Thanks TanyaC,
One question, can I suspend "Shut Down" with script or is shut-down inevitable.?
Let's say your script says "Shutdown /s /t 30"

If you intercept that shutdown command before the 30 seconds expires with "shutdown /a" it will cancel the pending shutdown.

I always use a value > 0 when I used automated shutdowns, because that gives you the chance to cancel it, but, it also gives the system time to finish of anything when the kill signal is sent to the processes, or so I'm told.

Tanya
My System SpecsSystem Spec
Reply

 Script to run before Shut Down




Thread Tools Search this Thread
Search this Thread:

Advanced Search




Similar help and support threads
Thread Forum
BSOD - Occurs during Shut Down Process. Shut Down hangs then crashes
Hey there, Lenovo E440 that ran excellent until recently. About a week or two ago I got an error message about a power surge on a USB port. Didn't really seem to effect much so I moved on. Lately, when shutting down, it hangs for a few minutes... just sitting at the final "Shutting Down"...
BSOD Help and Support
Shut Down - Enable or Disable Shut Down without Logging On
How to Enable or Disable Shut Down without Having to Log On This will show you how to enable or disable all users to be able to shut down the computer without having to log on in Windows 7. This will add or remove the red shut down menu box in all Log on and Switch user screens. You will...
Tutorials
Shut Down Windows - Change "Install Updates and Shut Down" as Default
How to Change "Install Updates and Shut Down" as Default Choice in Shut Down Windows Dialog This will show you how to manage whether the Install Updates and Shut Down option is allowed to be the default choice in the ALT+F4 Shut Down Windows dialog and Start Menu "Shut Down" power button...
Tutorials
shut down script
I have a script that i put in Gpedit Computer/user logon/logoff startup/shutdown i have 7 systems it runs from DOS and from desktop if bat file placed there only 2 systems actualy run at shutdown I'am confused to why it doesn't work on other 5 systems
Performance & Maintenance
Shut Down Windows - Enable or Disable "Install Updates and Shut Down"
How to Enable or Disable "Install Updates and Shut Down" Option in Windows 7 This will show you how to enable or disable the Install Updates and Shut Down shield on the Start Menu "Shut Down" power button and option in the ALT+F4 Shut Down Windows dialog box for users in Windows 7 when...
Tutorials
Screen shut-off requires hard shut down
I work on my Gateway while sitting on the couch. I surf the Internet and then watch TV. I surf a little more, and then I watch more TV. Some nights, when I slide the computer near me because I've shifted in my seat, the screen will go black and I have to push the On/Off switch until the computer...
General Discussion


Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 20:11.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App