vbscript >> How do I schedule a script to run at shutdown? TIA

by Stuffin » Mon, 15 May 2006 23:50:33 GMT

By using task scheduler I can schedule a script to run at system startup,
but not shutdown. Any ideas how I can do this? TIA



vbscript >> How do I schedule a script to run at shutdown? TIA

by Dave Patrick » Mon, 15 May 2006 23:54:48 GMT


Use the Group policy editor
%systemroot%\system32\gpedit.msc
Computer Config\Windows Settings\Scripts\Startup/Shutdown

--

Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect


| By using task scheduler I can schedule a script to run at system startup,
| but not shutdown. Any ideas how I can do this? TIA
|
|

Similar Threads

1. schedule shutdown with startup script

2. ShutDown Script - Abort Shutdown

The only way that I know to abort a shutdown like this is to have a
program running that doesn't respond to the shutdown after a set period
of time (defined in the registry).  This causes the "End Program"
msgbox to appear and if you cancel that, then the shutdown cancels.

Michael Reese
Information Systems Technician

3. Running a Shutdown script with VBS

4. Problem aborting shutdown in shutdown script

Hi all,

We have a departmental win2003 server that has to be shut down
everyday, for which I wrote a small shutdown script in vbscript to give
users the chance to bail out if somebody were logged in via shared
folders or a terminal server session.

The script essentially makes a list of Lanman sessions (via ADSI with
winnt://computername/LanmanServer), parses the output of qwinsta.exe,
and outputs a message box with the list of connected users, offering
the chance to abort shutdown. If the console user decides to abort
shutdown, shutdown.exe -a is called using wshShell.Run.

Problem is, shutdown is never aborted no matter what the user clicks in
the msgbox. Barring syntax or logical errors, is anybody aware of a
reason for this behavior? I can post the script if necessary.

On a related note, are shutdown scripts run under the SYSTEM account?
Are they run just before the actual shutdown sequence is started?

regards,
alejandro

5. Scheduling a script to run a program

6. Trouble writing script to run as scheduled task

I have an application that oddly enough will ONLY run as a scheduled task.  
The app generates some reports in the background and is generally meant to be 
run after hours.  I can create a scheduled task that runs a command from the 
command line with the appropriate switches.  The problem is that I have 
almost 80 reports and I really don't want to maintain a scheduled task for 
each.  I'd like to batch the reports together into daily, weekly, & monthly 
scripts (or by just passing in a reporting period command line switch into a 
single script).  Since this app will not even run from the command line 
(remember it seems to require that it only run as a task), I can't seem to 
determine a way to do this.  I've tried using a run command for the Wshell 
object with every conceivable initialization parameter.  Does anyone have a 
suggestion as to how to accomplish this task?  I've also tried this with a 
simple .bat file with the same results - the task will not run.

7. running a vbs script in scheduled task

8. VB script won't run via schedule task

I've wrote a VB Script to backup my exchange server and i put it into 
schedule task to run every day. 
first script does a full backup of storage groups and it do it fine
but the second script, which does an incremental backup, wont run.

I've checked s.task and i saw myscript is running, after few hours was the 
same. 
Event viewer show only in security tab myuser logon (user who is permited to 
run script) and nothing else. After using end taks on myscript in schedule 
tasks backup finished succesfully and everything was correctly written into 
event viewer.

If i run script manualy, double click on myscript.vbs, everything is working 
fine.


Any idea?
Thanks