Once you have checked all the Software Requirements are honoured then you can download the script from the Download section of this project. It's highly recommended to stay on the latest release.

The download is a single archive file containing two scripts and a text file:
  1. 7zbackup.ps1 which is the script containing the logic
  2. 7zbackup-vars.ps1 which is the script containing the variables
  3. 7zbackup.selection.sample.txt which can be used as a template for your selection directives
What is really needed is 7zbackup.ps1: all it's variables can be valued passing command line arguments. But in case you want to hardcode some variables on your system, then 7zbackup-vars.ps1 is the place to look at. Both the scripts must be placed in the same directory. For the scope of this whole documentation I assume you have placed the scripts in %systemdrive%\Scripts (generally speaking C:\Scripts).

Before you can run the script I warmly recommend you the reading of this Technet Article about running powershell scripts. Please take note that this script is not signed.

Now open a PowerShell prompt and move to the location where you have placed the downloaded scripts using normal cd command, until your prompt shows like this.
"PS C:\Scripts>"
We're ready to dot source the script for the first time. We will do this by typing:
"PS C:\Scripts> .\7zbackup.ps1 --help" Enter
You should receive this output
 ------------------------------------------------------------------------------

  7zBackup.ps1 ver. 1.9.0-Stable (http://7zbackup.codeplex.com)

 ------------------------------------------------------------------------------

 Usage : .\7zBackup.ps1 --type < full | incr | diff | copy | move >
                        --selection < full path to file name >
                        --destpath < destination path >
                       [--workdrive < working drive letter >]
                       [--rotate < number >]
                       [--maxdepth < number > ]
                       [--prefix < string >]
                       [--clearbit < True | False >]
                       [--archivetype < 7z | zip | tar >]
                       [--password < string >]
                       [--workdir < working directory > OBSOLETE]
                       [--7zipbin < path to 7z.exe > ]
                       [--jbin < path to Junction.exe > ]
                       [--logfile < filename >]
                       [--notifyto < email1@domain,email2@domain >]
                       [--notifyfrom < sender@domain >]
                       [--smtpserver < host or ip address >]
                       [--smtpport < default 25 >]
                       [--smtpuser < SMTPAuth's user >]
                       [--smtppass < SMTPAuth's password >]
                       [--smtpssl < True | False >]
 ------------------------------------------------------------------------------

 --type        Type of backup to perform:
               full : All files and archive bit cleared after archiving
               diff : Files with archive bit set.
                      Archive bit left unchanged after backup.
               incr : Files with archive bit set.
                      Archive bit cleared after backup.
               copy : Same as FULL but leave archive bits unchanged
               move : All files matching selection criteria regardless
                      their Archive bit status. After succesful operation
                      archived files are deleted from their original
                      location. Use with great care.

 --selection   Full path to file containing the selection criteria

 --destpath    Full path to destination media which will contain the archive.
               Ensure it will be on a drive with sufficient space to
               contain all the data. Can be a UNC path.

 --workdrive   Drive letter to use for creation of root junction point.
               If not set the script will use the drive associated to
               the TEMP environment variable. It MUST be a valid
               drive letter with the exclusion of A and B. Drive associated
               to this letter must have NTFS file system and it's root
               must be writable.

 --archivetype The type of archive you want to create.
               7z   : default format with better compression
               zip  : very compatible with other programs
               tar  : Unix and linux compatible but only archiving (no compression)

 --rotate      This value must be a number and indicates the number of
               archives that should remain on disk after successful
               archiving. For example if you set --rotation 3 on a
               full archiving operation it means that the newest 3 full
               archives will be kept on disk while the oldest (if any)
               will be deleted. If this value is NOT set then ALL the
               generated archives will be kept on disk. Please be advised
               that in such case your target media will be likely get
               out of space soon. It can be specified either as command argument,
               or in the hardcoded vars file, or in the selection file.

 --maxdepth    This value si a zero-based index limiting the depth of recursion
               while scanning in search of files to backup. Valid values are
               in range 0 (which means only the first level) to 100 which
               is the maximum value assumed by default. It can be specified
               either as command argument, or in the hardcoded vars file, or
               in the selection file.

 --clearbit    In backup operations of type FULL or DIFF the Archive attribute
               of backupped files is cleared. If you do not want the script
               to do this simply pass --clearbit False. On the other hand
               if you do want to clear the attribute even in other backup
               types then pass --clearbit True

 --password    Use this switch if you want to password protect your
               archive. No spaces in passwords please.

 --prefix      The prefix to use to generate the archive name.

 --workdir     SUPERSEDED (will be simply ignored)
               Directory which will be used as working area.
               Must be on an NTFS file system. If none is given then
               the procedure will try to use the one in environment's
               TEMP variable.

 --7zipbin     Specify full path to 7z.exe.
               If the argument is not provided the script will try to
               locate 7z.exe in :
               C:\Program Files\7-zip\7z.exe

 --jbin        Specify full path to Junction.exe.
               If the argument is not provided the script will try to
               locate Junction.exe in :
               C:\Program Files\SysInternalsSuite\Junction.exe
               This parameter is optional when the script is invoked
               on Windows Vista / 7 / 2008 which support MKLINK.

 --logfile     Where to log backup operations. If empty will be
               generated automatically.

 --notifyto    Use this argument to set a list of email addresses who
               will receive an email with a copy of the logfile.
               You can specify multiple addresses separated by commas.
               If you set this switch be sure to edit the script and
               insert propervalues in variables $smtpFrom $smtpRelay and $smtpPort

 --notifyfrom  Use this argument to set the proper address to use as
               sender address when sending out email notifications

 --smtpserver  Host name or IP address of the server to use

 --smtpport    Port number of the smtp server (Default is 25)

 --smtpuser    Smtp's authenticated user (if smtpauth required)

 --smtppass    Smtp's authenticated password (if smtpauth required)

 --smtpssl     Wether or not smtp transport requires ssl

 -----------------------------------------------------------------------

If you see this you're ok with the script and your execution policies allow you to run it. You can now proceed to the examination of The -vars file.

Last edited Jan 12, 2013 at 4:37 PM by Anlan, version 4