[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

run a .bat or script file only on restart not shutdown

Posted on 2011-03-01
6
Medium Priority
?
553 Views
Last Modified: 2012-05-11
is there a way to run a .bat file or script only on a restart vs a shutdown command?
gpmc i believe only lets me apply it to a shutdown or restart, as i only want the it to run if a user or a wsus update tells the system to restart. it must be hidden with no user interaction.
i can not run any freeware or what not.
Vista SP2 Enterprise

or a similar solution!
Thanks,
0
Comment
Question by:DCSIMVT
  • 2
4 Comments
 
LVL 27

Expert Comment

by:Steve
ID: 35011885
You're going to struggle on that one without some form of script on the PCs. AD & group policies cannot distinguish between a shutdown and a restart.

There are ways to work it out on startup (parsing the event logs for example) but nothing as simple as you are hoping for.
0
 
LVL 14

Accepted Solution

by:
BigBadWolf_000 earned 1000 total points
ID: 35012053
A restart is a shutdown and a startup...so no not from the system

But if you want a restart to launch a script before shut down you would have to launch the the script to do the restart with the shutdown /r parameter.

0
 

Author Comment

by:DCSIMVT
ID: 35278283
i have not found any answer,
please delete
0
 
LVL 27

Assisted Solution

by:Steve
Steve earned 1000 total points
ID: 35308786
you have got an answer to your question: No.

Your requirement of it being hidden from users view and using 'no freeware or what not' means the answer is no.
It may not be the answer you wanted but it is still an answer to your original question.

The reason is that PCs cannot distinguish between a restart and a shutdown by default.
It may be possible to create a VB script or batch file that could parse the event log to work out how long it was turned off for and assume its a restart if the time is particularly short, but this may use freeware utils to parse the event logs, which you have ruled out.

It may be possible to use a freeware util to do this without the script, but your question specifically prohibits this.

0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

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

Microsoft Office 365 is a subscriptions based service which includes services like Exchange Online and Skype for business Online. These services integrate with Microsoft's online version of Active Directory called Azure Active Directory.
A bad practice commonly found during an account life cycle is to set its password to an initial, insecure password. The Password Reset Tool was developed to make the password reset process easier and more secure.
Progress
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

834 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