Thursday, July 5, 2012

Powershell script to take backups on USB Drive.



For one of my friend i was working on a backup Script. He want to take his backup to a USB Drive.

First time i thought that it is going to be easy , but found some glitches but fixed them later using "BING" :o) .

Download the Script from this link :

This script is simple.

  1. Check for any USB DISK attached { for now it works only with one USB attached"
  2. If the USB disk in attached,after that it calculated the total amount of data in the folder specified
    1. If the total size of data is Greater Then Free Disk space, it gives you an error
    2. If we have more then free space of total amount of data , then it create a folders in USB Drive named as
      1. backup_DATE
    3. Once data is copied successfully , it open backup Folder

By default it backup only

  1. C:\Users\URSERNAME\Desktop
  2. C:\Users\URSERNAME\Documents
  3. C:\Users\URSERNAME\Music
  4. C:\Users\URSERNAME\Pictures
  5. C:\Users\URSERNAME\Downloads
  6. C:\Users\URSERNAME\Favourites

and i am using Robocopy.exe to take backup.

and i tested this script on windows7 OS with One USB Drive attached and it works for me .

Few Screenshots

05-07-2012 11-59-35

05-07-2012 13-02-06

04-07-2012 15-44-50


Download the Script from this link : 


Thanks for reading.


Aman Dhally

Buy-More-Twitter-Followers  4fb29548b6adc


1 comment:

  1. Hi,

    Good post,I need an help in this script.
    I have a c:\ drive with 50 gigs, and d:\ drive with 200 gigs.
    I have a s3 account. As of now i am taking a back up on D drive.
    I want to know move the backup from D drive to S3 account or drive. Can you help me on this