Snapshot - command line options

Well - having a nice Windows interface is a fine thing - unless you want to automate certain things, which often is sheer impossible with all this Windows wizardry, often requiring dozens of clicks to accomplish even trivial tasks - just try to automate a Backup of your data with your favourite CD-ROM burning program.

Drive Snapshot has a very easy command line interface:

Backup Drive to file

        C:\> SNAPSHOT C:   X:\C-Drive.sna

this will backup the C: drive to X:\C-Drive.SNA.

To save several Volumes, simply create a Batch file like 

SNAPSHOT   C:   \\Server\Backups\C-Drive.sna 
SNAPSHOT   D:   \\Server\Backups\D-Drive.sna 
SNAPSHOT   E:   \\Server\Backups\E-Drive.sna 

This will backup C:, D:, E: to your server..

Alternatively you can use

SNAPSHOT C:+D:+E: \\Server\Backups\$disk-Drive.sna

to backup C: and D: and E: at once.

To create a backup of all partitions on a physical disk (here HD1) use:

SNAPSHOT HD1:* \\Server\Backups\$disk-Drive.sna

    Option -L1450

Most of the time, it's sensible to limit the size of a single image file to some maximum value, so it can be written to a CD-ROM.
The default maximum size is 1450MB; you can change this with the -L parameter.
To avoid trouble with DOS when restoring your drives, you should keep this below 2 GB.

     Option -R  [empty Recycle bin ]

This will empty the Recycle Bin for this drive before starting the backup.

    Option -W  [Wait]

If the cursor is in the top left corner at the time of start, Snapshot assumes it has been started from a batchfile, and waits for the <ANY> key at end, so you can control the execution.
This is probably unwanted, if it was started from the scheduler.
This WaitForAnyKey can be suppressed with -W.

    Option -G  [Graphical]

For those who have created a shortcut to a customized Snapshot command,  but still want to see a graphical progress.

Useful if you have configured a shortcut or similar for automatic backup, telling the user 'Click here to backup your drive'.

It has a few sub modes like

    -G     show progress, wait for user to click [exit] when done 
    -Go  show progress, exit when done if everything worked, else tell him so
    -Gm  start minimized
    -Gx  show progress, always exit when done

    Option -T  [Test]

You can request a test of the image for validity, after it has been created.
This will completely reread the image and check its consistency, checksums,...
However (in particular in batchfiles) it's probably better to test the image separately ;like

    snapshot x:\image.sna -T

so you can know whether a failure was due to the destination server being down, or 'unreliable data written'.

Any failure will be returned as Errorlevel > 0.

Differential Backups

    please see differential.htm for detail

Set a Default Password from command line


This password will be used for backup, restore, and mount from now on.
Restore and mount will ask for the password, should it be needed.

Restoring a Volume

        C:\> SNAPSHOT  X:\D-Drive.sna   D:

restores the D: drive from X:\D-Drive.sna.
This will overwrite all data on the D: drive !!

The limitations are identical to the normal Snapshot Restore.

Setting the password from the command line

From the command line, you can set the password with  -PW=SuperSecret 

        C:>Snapshot C: X:\Backup\c-drive.sna -PW=SuperSecret

This overrides a default password for this command only.
If you have a default password, and don't set one from the command line, the default is used.
If you have a default, but nevertheless don't want your image encrypted, you have to indicate an empty password:

        C:>Snapshot C: X:\Backup\c-drive.sna -PW=

Excluding files/directories from backup

In some cases it can be useful to exclude some files or directories from backup.

That's always the case for (and is always done automagically) for PAGEFILE.SYS and HIBERFIL.SYS, but can also be useful for temporary files, big movie archives (which you have on the bought DVD anyway and similar stuff.

Due to technical reasons, the data in excluded files are not saved, but the directory entries ARE saved.
Therefore, both when viewing the backup, and after restoring, the files *look* intact, but contain all zero's (when viewing) or random data (after restore).

For this reason, the image contains a fresh created Batch job 'SnapshotDeleteAfterRestore.BAT'.
After restore it should be executed to avoid possible confusion (it will delete all unsaved files).

Files and directories can be excluded by

    --exclude:\Temp\* (which is equivalent)

options can be concatenated with commas like

    --exclude:\Temp,\Windows\Memory.dmp,\Windows\Minidump\*,"\Documents and Settings"
,"\Program Files",\Windows\$NtUninstall* (1.38)

            \temp and \temp\*  are equivalent
            Spaces in Filenames have to be enclosed by `"`

Subdirectories are also always excluded.

Creation of filenames with date, weekday, ...

Some 'magic' strings in the command line are replaced with the data, computer name, disk, etc.

So it makes sense to 

     c:\>snapshot  C:  \\server\backups\$computername\$DISK-$DATE.sna

$date  Date 6-digit  YYMMDD
$computername  Computer name
$type  for differential Images --> 'dif'
$disk  the drive letter (C,D,...)
$weekday  weekday, 2 letters
$year  year (4 digits)
$month  month (1..12)
$day  day in month (1..31)
$week  week number (1..53)


Mount a disk Image as virtual drive

        C:\> SNAPSHOT  X:\C-Drive.sna   Z: -V

mounts the image X:\C-Drive.SNA as drive Z:

with a couple of variants:

    -VM    just mount the image, don't start Explorer

    to be used in batch files
            -VQ Z:             mounts the volume,  doesn't show any dialog
            -!unmount:Z   unmount Z:
            -!unmount      unmount all mounted drives (from 1.38)

    Snapshot should be started with 'start' like 

           start Snapshot x:\image.bat Z: -vq
           xcopy z:\Data c:\Data  
           Snapshot -!unmount:Z

additionally File Extensions 

work as expected

repairing damaged images

Unfortunately, images can be damaged.
Some image sub-files may be missing or unreadable, data may be damaged, etc., and the image isn't mountable any longer.

As a disk image, this is useless as you will never know what data are missing.

But often all you need is a few files from the image.
If the .SNA file is existing, 

        c:>snapshot x:\DAMAGED.SNA  --repair:Y:\REPAIRED.SNA 

will try to reconstruct something mountable; at least after running CHKDSK over the virtual drive you should be able to retrieve some data. The new image needs approx. the same size as the original image.

1.44  With the command

        c:>snapshot x:\DAMAGED.SNA  --repair:Y:\REPAIRED.SNA --OnlyOffsetInfo

the new image Y:\REPAIRED.SNA contains the offset information only. This kind of repair operation uses much less disk space. The image can be mounted with the command

        c:>snapshot x:\DAMAGED.SNA  --OffsetInfoFile:Y:\REPAIRED.SNA 

Migration to different hardware

If you restore using VistaPE/BartPE, running 

        c:>snapshot --AddDriver

will ask you for the driver to be installed, and the location of the (restored) Windows, and install this driver as an additional disk driver



more special options during backup

  --LogFile:C:\LOGFILE.TXT redirects output to C:\LOGFILE.TXT um.
1.47 --Version print out the version number of Snapshot and exit.
indicates usage of Windows VSS services or the internal driver
  --AllWriters uses VSS services in a way that all supporting applications (exchange, oracle, SQL server,...) are notified about start of backup, and successful finish; see also VSS. this also truncates transactions logs
  --ExcludeWriter: "NameWriter1","NameWriter2","NameWriter3"...
sets implicit --AllWriters, but disables a given writer; see also VSS
  --IncludeWriter: "NameWriter1","NameWriter2","NameWriter3" ...
uses only the  given list of writers
  --CreateDir creates automatically the destination directory
1.43 --DedupTarget optimizes (somewhat) the storage requirements on a deduplicating Server 2012; disables compression
1.43 --AutoBackupSize:512 if set, all small partitions on the same drive are also backup'ed (as HD1-1.sna, HD1-2.sna,...). the intention is tosave all partitions necessary to boot the system.
allows exclusion of directories, files or files types from backup.
1.46 --FastDiff:\*.vhd
using this option can speed up differntial images. All files and folders given in the command line won't be read if the file size, the modification date and the used clusters haven't changed since the last full backup.
1.46 --EjectDriveAfterBackup Eject/Dismount a removable drive after successful image creation.
1.47 --EjectMediaAfterBackup Eject/Eject the backup medium after successful image creation.
  --FullIfHashIsMissing if during a differential backup a corrupt or missing hash files is detected, a new full backup is created
  --exec:"NET START ORACLE" 
for use with the internal driver: after snapshot creation (just a few seconds after starting the backup), you can execute external command. has to be the last command on command line!
  --LimitIORate:10 limits maximum I/O rate on the destination drive to 10MB/s ( 1-100)


special options during restore

  --Activate X:
--Deactivate X:

(de) activates the partition X:

  --resize C: 100000 enlarges the file system C: auf 100 GB, or at most to the existing partition size(see also)
  --resizepart C: 100000 enlarges both partition and file system to 100 GB
         --resizepart can't shrink the partition!
  --RestoreMBR HD1 filename - restores exactly the first 512 byte of a partition
  --RestorePartitionStructure HD1
restores all partitioning information, including boot code (up to 63 sectors), extended partitions,...
recommended instead of --RestoreMBR
1.43 --Extendpartitions:Image.sna HD1 as --RestorePartitionstructure, but grows all NTFS partitions proportional to fill the disk
1.44 --EntireDisk Image-C.sna HD1 Restores the partitions strucutre and all images saved with the same snapshot command (snapshot HD1:* Image-$disk.sna) to disk HD1
  --Schedule C: D:\image.sna   schedules restore of C: from file D:\IMAGE.SNA for the next restart. D: must be a fixed drive; network drives are not supported
  --ListSchedule shows a possibly scheduled restore
  --RemoveSchedule removes scheduled restores
rules behaviour after restore:
the computer will restart never/always/only no errors happened.
adds additional (disk-) drivers. See Hardware
  --ClearSignature HD1
--SetSignature HD1 01234567
sets/removes disk signature
shows in two different formats information about found drives and partitions


special options when mounting image files

  --SearchFull:Fullpath when mounting a differential image, and the full image is located somewhere else.


other special options

  --? list of all available options
  --setdefaultpwd=MyPassword enters into registry a password with which coming images will be encrypted and decrypted per default.
1.47 --setdefaultencpwd=MyPassword enters into registry a public key generated from password with which coming images will be encrypted per default.
 1.47 --setdefaultdecpwd=MyPassword enters into registry a password with which coming images will be decrypted per default.
 1.47 -pwgen=Key.txt -pw=MyPasswort generates a public key file which can be used to encrypt en image
 1.47 -pwuse=Key.txt uses a public key file generated with -pwgen to encrypt en image
tries to make most out of an image where parts are missing, unreadable, or destroyed. no warranties.
1.46 --repair X:CORRUPTED.SNA Snapshot will try to repair the image CORRUPTED.SNA. All repaired data will be appended to the existing image. You need at least version 1.46 of Snapshot to mount the repaired image.
  --QuickCheck:test.sna quick check if he images looks complete, and has some magic words at start and end of backup. does not replace a complete test using -T
1.46 --DeepVerify if used in addition to -T the image will be verified using the algorithm used until version 1.45.
  --register:Lizenzdata.txt generates a licensed snapshot.exe using the license info that we sent to you.
  --merge:new_full.sna diff_image.sna combines a full and a differential image into a new full
1.44 --NetUse:\\server\share,N:,Username,Password connects the network share \\server\share with drive letter N:
1.44 --NetUse:\\server\share,Username,Password connects the network share \\server\share \\server\share without using a drive letter
1.44 --AddFTPAccount:Username,Server,Password,Port Adds a FTP account with the given credentials. If the port number is omitted, the default port (21) will be used.
1.44 --DeleteFTPAccount:Username,Server,Password,Port Deletes the FTP account for the user with the given credentials. If the port number is omitted, the default port (21) will be used.
1.44 --AddFTPAccount:Username,Server,Password,Port Fügt einen neuen FTP-Account für den angegebenen Benutzer hinzu. Wenn die Portnummer nicht angegeben wird, wird der Standard FTP-Port 21 verwendet.
1.44 --DeleteFTPAccount:Username,Server,Password,Port Deletes the FTP account for the user with the given credentials. Type is either FTP or SFTP.
1.50 --AddFTPAccount:Type,Username,Server,Password,Port Adds a FTP account with the given credentials. Type is either FTP or SFTP. If Port is omitted the default port is used (21 for FTP and 22 for SFTP).
1.50 --DeleteFTPAccount:Type,Username,Server,Password,Port Deletes an existing FTP account. Type is either FTP or SFTP. If Port is omitted the default port is used (21 for FTP and 22 for SFTP).
1.50 --ListFTPAccounts Lists all configured (S)FTP accounts.
1.50 --AcceptHostKey Accepts the host key for a SFTP connection/
1.50 --StoreHostKey Stores the host key in the registry.
1.50 --PuttyKeyFilename:<KeyFileName.ppk> The file FileName.ppk will be used for authentification with the SFTP-Server. The key file must be provided in putty format.


Copyright © 2001-2022     Tom Ehlert Software