Batch at shutdown get prematurely terminated

T

ToddAndMargo

Hi All,

I have a batch file that I run at shutdown on an
XP-Pro-SP3 computer:

REGEDIT4

[HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\System\Scripts\Logoff\0\0]
"Script"="C:\\NtUtil\\Backup-ExtHD3.bat"
"Parameters"=""
"ExecTime"=hex(b):00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00

The last thing I do in the batch file it call Abakt, which
copies a list of files to my backup drive:

echo Backing up selected files (Abakt)
echo Your Abakt profile is: %Profile2%
%Abakt% -b -x "%Profile2%"

Abakt will run for about 10 minutes, the windows shutdown
screen will come up stating that it is running logoff
scripts, switch to Windows is Shutting Down, and
then the machine powers off.

Problem: Abakt takes about 30 minutes to complete is tasks.

Is there a way to tell windows to wait for my backup script to
complete fully before shutting down?

Many thanks,
-T
 
T

Terry R.

The date and time was Friday, April 17, 2009 2:40:16 PM, and on a whim,
ToddAndMargo pounded out on the keyboard:
Hi All,

I have a batch file that I run at shutdown on an
XP-Pro-SP3 computer:

REGEDIT4

[HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\System\Scripts\Logoff\0\0]
"Script"="C:\\NtUtil\\Backup-ExtHD3.bat"
"Parameters"=""
"ExecTime"=hex(b):00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00

The last thing I do in the batch file it call Abakt, which
copies a list of files to my backup drive:

echo Backing up selected files (Abakt)
echo Your Abakt profile is: %Profile2%
%Abakt% -b -x "%Profile2%"

Abakt will run for about 10 minutes, the windows shutdown
screen will come up stating that it is running logoff
scripts, switch to Windows is Shutting Down, and
then the machine powers off.

Problem: Abakt takes about 30 minutes to complete is tasks.

Is there a way to tell windows to wait for my backup script to
complete fully before shutting down?

Many thanks,
-T

Hi Todd,

I have a backup script run at shutdown also. Have you tested it at a
command prompt so you can watch it execute? I have copy and error logs
written in my batch file that open on Startup the next day, so I can
verify it completed properly. You might want to add something like that
to your batch file, or have the log from your backup program open.

As an aside, if you're launching the file using the group policy
Shutdown script, echo isn't really needed since you don't see what is
happening anyway.


Terry R.
 
J

John John (MVP)

ToddAndMargo said:
Hi All,

I have a batch file that I run at shutdown on an
XP-Pro-SP3 computer:

REGEDIT4

[HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\System\Scripts\Logoff\0\0]

"Script"="C:\\NtUtil\\Backup-ExtHD3.bat"
"Parameters"=""
"ExecTime"=hex(b):00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00

The last thing I do in the batch file it call Abakt, which
copies a list of files to my backup drive:

echo Backing up selected files (Abakt)
echo Your Abakt profile is: %Profile2%
%Abakt% -b -x "%Profile2%"

Abakt will run for about 10 minutes, the windows shutdown
screen will come up stating that it is running logoff
scripts, switch to Windows is Shutting Down, and
then the machine powers off.

Problem: Abakt takes about 30 minutes to complete is tasks.

Is there a way to tell windows to wait for my backup script to
complete fully before shutting down?

By default the maximum wait time for Group Policy scripts is set to 10
minutes, you can change this timeout value via the Group Policy Snap-in
(enter gpedit.msc in the Start menu Run box).

If you change the settings via GPO it will add MaxGPOScriptWait value at
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\system

Another way around your problem would be to launch the backup and
shutdown entirely from a batch file instead of using a logoff or
shutdown script. If you call the backup batch from another batch file
it will wait for the backup to complete before returning control to the
batch file that made the call, then the batch file can run a shutdown
command.

John
 
T

ToddAndMargo

John said:
ToddAndMargo said:
Hi All,

I have a batch file that I run at shutdown on an
XP-Pro-SP3 computer:

REGEDIT4

[HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\System\Scripts\Logoff\0\0]

"Script"="C:\\NtUtil\\Backup-ExtHD3.bat"
"Parameters"=""
"ExecTime"=hex(b):00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00

The last thing I do in the batch file it call Abakt, which
copies a list of files to my backup drive:

echo Backing up selected files (Abakt)
echo Your Abakt profile is: %Profile2%
%Abakt% -b -x "%Profile2%"

Abakt will run for about 10 minutes, the windows shutdown
screen will come up stating that it is running logoff
scripts, switch to Windows is Shutting Down, and
then the machine powers off.

Problem: Abakt takes about 30 minutes to complete is tasks.

Is there a way to tell windows to wait for my backup script to
complete fully before shutting down?

By default the maximum wait time for Group Policy scripts is set to 10
minutes, you can change this timeout value via the Group Policy Snap-in
(enter gpedit.msc in the Start menu Run box).

If you change the settings via GPO it will add MaxGPOScriptWait value at
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\system


Another way around your problem would be to launch the backup and
shutdown entirely from a batch file instead of using a logoff or
shutdown script. If you call the backup batch from another batch file
it will wait for the backup to complete before returning control to the
batch file that made the call, then the batch file can run a shutdown
command.

John

Hi John,

I see your point. I will take your advice and have the batch
file do the shutdown.

Thank you,
-T
 
T

ToddAndMargo

Terry said:
As an aside, if you're launching the file using the group policy
Shutdown script, echo isn't really needed since you don't see what is
happening anyway.

It is so I can see what is happening when I test it outside of shutdown.
 
J

John John (MVP)

ToddAndMargo said:
John said:
ToddAndMargo said:
Hi All,

I have a batch file that I run at shutdown on an
XP-Pro-SP3 computer:

REGEDIT4

[HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\System\Scripts\Logoff\0\0]

"Script"="C:\\NtUtil\\Backup-ExtHD3.bat"
"Parameters"=""
"ExecTime"=hex(b):00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00

The last thing I do in the batch file it call Abakt, which
copies a list of files to my backup drive:

echo Backing up selected files (Abakt)
echo Your Abakt profile is: %Profile2%
%Abakt% -b -x "%Profile2%"

Abakt will run for about 10 minutes, the windows shutdown
screen will come up stating that it is running logoff
scripts, switch to Windows is Shutting Down, and
then the machine powers off.

Problem: Abakt takes about 30 minutes to complete is tasks.

Is there a way to tell windows to wait for my backup script to
complete fully before shutting down?

By default the maximum wait time for Group Policy scripts is set to 10
minutes, you can change this timeout value via the Group Policy
Snap-in (enter gpedit.msc in the Start menu Run box).

If you change the settings via GPO it will add MaxGPOScriptWait value
at
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\system


Another way around your problem would be to launch the backup and
shutdown entirely from a batch file instead of using a logoff or
shutdown script. If you call the backup batch from another batch file
it will wait for the backup to complete before returning control to
the batch file that made the call, then the batch file can run a
shutdown command.

John

Hi John,

I see your point. I will take your advice and have the batch
file do the shutdown.

Thank you,

You're welcome.

John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Shutdown on Logoff 1
What is the GroupPolicy? 3
Wot's yer backup 8
Shutdown script premature termination 3
command line shutdown 3
command line shutdown 2
Very slow shutdown 9
Logon script not running 5

Top