Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Script for Automatic Backup then Shutdown

Posted on 2009-04-16
13
Medium Priority
?
1,235 Views
Last Modified: 2012-08-14
I need a program or script to run unattended at a certain time, such as 9:00pm, on machines with XP and Vista which will

1. Backup a select group of files to the corporate server
2. Create a "success" message or log for the desktop
3 Shutdown after backup
0
Comment
Question by:rdperkins
  • 9
  • 4
13 Comments
 
LVL 31

Expert Comment

by:Wayne Barron
ID: 24165114
you can use robocopy
To do this.

Give me a few minutes to get all the details for you

Carrzkiss
0
 
LVL 31

Expert Comment

by:Wayne Barron
ID: 24165176
here is a start for your.
This includes the  new windows 2003 server Robocopy.exe
This can be run on all version of windows from win2k, winxp, vista and maybe win7.

As well as a script that I made up.
As well as a readme.txt file.

http://ee.cffcs.com/Q_24330834/Robocopy.zip

I am still looking into running this and shutting down the computer afterwards.
But this will get you familuar with the Robocopy.exe and what it can do.

Carrzkiss
0
 
LVL 31

Expert Comment

by:Wayne Barron
ID: 24165313
ok
Updated the file with a Shutdown script
And then Readme.txt file has information in it for the Scheduling of the task.
(Look at the bottom of the readme.txt file)

http://ee.cffcs.com/Q_24330834/Robocopy.zip

Good Luck
Carrzkiss
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 31

Expert Comment

by:Wayne Barron
ID: 24165351
I had to update the file.
If you downloaded the one with the
Backup to server.cmd
With the shutdown script in it
Do not use it.

The updated one has a
Backup to server.bat

This can be run under the task manager.
http://ee.cffcs.com/Q_24330834/Robocopy.zip

(Last post, I think that I have covered everything now)
Good Luck
Carrzkiss
0
 

Author Comment

by:rdperkins
ID: 24175146
Thanks carrzkiss, will try next week at work.
0
 

Author Comment

by:rdperkins
ID: 24183661
I can see how this could be scheduled on a time basis, but this really needs to happen when the computer is being shutdown. I am doing more than backing up a PST file, I am first copying it to a flashdrive, then to the server, then the machine can shutdown if there are no errors.

Nothing like changing specs in mid-stream.

Suggestions?
0
 
LVL 31

Expert Comment

by:Wayne Barron
ID: 24186552
I did a lot of research on doing a backup during shutdown
The 1st thing that gets closed is the Network Connection during shutdown.
So as far as I know, it is not going to work.

If you know exactly WHEN the computer is going to be shutdown.
Then you can schedule the script that I provided to run during that time.

This line in the .bat file
shutdown -s -t 60
Can be changed to what ever # you want it to be.
Instead of 60-seconds.
It can be: 120, 180 or more. Or even 5-seconds.

You can add in the line of code as demostrated in the Readme.txt file.
To point to the Flash Drive as well.
So, the first thing that is done is the Flash Drive.
Then the 2nd thing that is done is the Server Backup.

---------------
>> I am doing more than backing up a PST file

I use this script to backup Gb's of information from drive to drive and drive to server drive.
This is one of the most Robust Backup scripts/software on the market that is FREE.
Before I even used Robocopy, I did a lot of testing on Paid Scripts / Programs.
And none of them gave you the flexibility that Robocopy gives to you.

Anyway.
If you decide to use it, great.
I am sure that you will enjoy it. I know that I love it everytime I have to do a backup.
Gb's of information speaks for itself.

Have a good one.
Carrzkiss
0
 

Author Comment

by:rdperkins
ID: 24231309
I've been trying to consider using the task scheduler but it won't work in this case. My best bet is to put bat files on each user's desktop and require them to execute the file to shutdown. My concern is that some might not do so, and was looking for a way to automatically execute the script whenever there was a shutdown.

Also what happens in the batch file if the flashdrive is not installed, or is full (in otherwords in an error situation)?
0
 
LVL 31

Accepted Solution

by:
Wayne Barron earned 2000 total points
ID: 24232677
As I mentioned before.
Once you choose to: ShutDown.
You WILL NOT be able to have access to the Network, as one of the first things to go is
Your Network Connection is closed.
This is for Security.

The only thing that I can suggest, is that if the computer have a set time to be shutdown.
Then run a Task then...

Please do the following.

Start | Programs | Accessories | System Tools | Schedule Tasks
[Add Scheduled Task]
Dialog opens.
Click [next]
Then click [Browse]
(Browse to the folder that has the .bat file for the Backup script and shutdown.)
Select the .bat file
Choose [Daily]
Then choose the time that you want it to start...
Example:  [5:30 PM]
Every Day
Start Date [4/25/2009]
Click [Next]
(Password for the users account)
Click [Next]
Then click [Finish]

=-=-=-=-=-=-=-=-=-=-=-=
This is tested, and this works.
=-=-=-=-=-=-=-=-=-=-=-=

You will have to set this up on every computer.
Maybe you could find out a way to make a script that will create this.
Not really sure, that would be another post all together.

hth
Getting ready to go to our Anual Dogwood Festival in Fayetteville N.C..
Have a good one.
Carrzkiss

0
 
LVL 31

Expert Comment

by:Wayne Barron
ID: 24266114
How is this one going?
This is a tested script and works great for what you are doing.
I am actually using it to run networking test, and have not experianced any issues with it.

Let me know,
Carrzkiss
0
 

Author Closing Comment

by:rdperkins
ID: 31571331
Hi Carrzkiss,

I'm from Hickory, NC, living in Charlotte, but working in Abu Dhabi. Thanks for the script/bat. It will do part of what I need, most actually, but doesn't handle the needs of the few staff who will want to take their Outlook PST file with them. This will have to be a separate batch file they can execute before they leave work, and they can leave their machine running. Later the task scheduler can make the backup to the server then shut down. Enjoy the dogwoods and Eastern Carolina barbeque.
0
 
LVL 31

Expert Comment

by:Wayne Barron
ID: 24270675
You are welcome.
It is always nice to see a fellow nc person in EE.

.pst file would be something like this.

(Assuming that they are using a USB drive to backup to)
(Change the locations to the proper location.
(K <-- assuming that K is the location of the backup drive))

robocopy "C:\Program Files\Office\Outlook\" "K:\Outlook Backup"  /S /V /TS /FP /LOG+:"C:\Documents and Settings\carrzxp\Desktop\Backup_Log.txt" /Z /R:10 /W:30

Good Luck in "Abu Dhabi" a long ways from home...

Carrzkiss
0
 
LVL 31

Expert Comment

by:Wayne Barron
ID: 24270705
Oh.
The dogwood fest was awesome.
Do you know who "Tisha Powell" is? From channel 11 News?
I met her on Saturday, she is a very sweet and beautiful woman.

Great weekend.
Have a good one.

Carrzkiss
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

I'm a big fan of Windows' offline folder caching and have used it on my laptops for over a decade.  One thing I don't like about it, however, is how difficult Microsoft has made it for the cache to be moved out of the Windows folder.  Here's how to …
When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup" or a blinking cursor with black screen. A loop for Auto repair will start but fix nothing.  You will be panic as there are no back…
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Suggested Courses
Course of the Month11 days, 2 hours left to enroll

885 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