Solved

Stop shutdown scripts running when restarting

Posted on 2004-10-14
9
60 Views
Last Modified: 2008-03-04
I have a shutdown script which is extremly useful when shuting machines down but very annoying when it runs on a restart. Is there a way to stop this happening?

Thank you
0
Comment
Question by:davidogdenblue
  • 4
  • 3
  • 2
9 Comments
 
LVL 24

Expert Comment

by:SunBow
ID: 12312201
how about "shutdown -a"?  [abort]

Syntax can vary by need and operating system used.
Here is good place to start if talking about Windows, DOS, and batch:
http://www.computerhope.com/shutdown.htm
0
 
LVL 24

Expert Comment

by:SunBow
ID: 12312219
> when it runs on a restart. Is there a way to stop this happening?

Do not place it in any of the startup areas, or startup sequence. I may not understand question, in this sense it seems too simple
0
 
LVL 1

Expert Comment

by:Edit-HTS
ID: 12316385
I couldn't find out how to do this myself so I've decided to just have two differnt batch files, one for shutdown and one for restart.

The restart script will simply restart and the shutdown script will do what you want it to do then shutdown.

E.g., restart batch:

/////
shutdown -r -f -t 10
\\\\\

and the shutdown:
//////
del C:\Windows\Temp\*.*
shutdown -s -t 10
\\\\\\

Using the windows utilities to implement shutdown scripts will run the script on both shutdown and restart of your machine as both of them shutdown windows and go from there.

Hope that helped a little bit.

-Edit
0
 
LVL 1

Expert Comment

by:Edit-HTS
ID: 12316387
And I meant to just have these on your desktop and use them to restart or shutdown the PC with a simple click of the mouse rather than doing the traditional 'start > shutdown > okay'.

-Edit
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:davidogdenblue
ID: 12327284
I'm sorry I haven't made myself clear. I don't need a script that shutsdown or restarts the PC.

I have a vbs script that runs an automatic defrag on machines. This is run using a shutdown script. The problem is when I have to restart a machine for whatever reason the shutdown script still runs. I'm looking for a way to only execute the shutdown script on a true shutdown not a restart.
0
 
LVL 1

Expert Comment

by:Edit-HTS
ID: 12330873
I posted that just in case you couldn't find a solution to the shutdown versus restart problem - it's a potential way of getting around the issue.

Instead of Clicking start > Shutdown > restart/shutdown and having Windows run the scripts the normal way, I'm saying you could force the issue by having an executable script that will perform whatever you want it to THEN restart or shutdown.

E.g., your defrag thing.  If you wanted to restart a machine you'd double click the restart script.  If you wanted to shutdown and defrag you'd double click the shutdown script.

Get me?

-Edit
0
 

Author Comment

by:davidogdenblue
ID: 12358271
This method would cause too much confusion for the users, who panic whenever new icons appear on the desktops. I wan't this to be transparent to them if possible.

Ideally I would like to check for a value which is set telling the PC to either shutdown or restart, I assume this would be hidden away in the registry somewhere.

Something like:

if \\"the registry entry" = True then Goto Defrag
else goto NoDefrag
0
 
LVL 1

Accepted Solution

by:
Edit-HTS earned 125 total points
ID: 12366167
Sorry I couldn't help :)

-Edit
0
 

Author Comment

by:davidogdenblue
ID: 12366999
Not a problem, you'll get the points if theres no other way.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Revenue table 8 87
Interest rate formula 7 59
Word Problem 4 76
Question to the line 4 38
Phishing is at the top of most security top 10 efforts you should be pursuing in 2016 and beyond. If you don't have phishing incorporated into your Security Awareness Program yet, now is the time. Phishers, and the scams they use, are only going to …
This story has been written with permission from the scammed victim, a valued client of mine – identity protected by request.
The Bounty Board allows you to request an article or video on any technical topic, or fulfill a bounty request to earn points. Watch this video to learn how to use the Bounty Board to get the content you want, earn points, and browse submitted bount…
Where to go on the main page to find the job listings. How to apply to a job that you are interested in from the list that is featured on our Careers page.

932 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now