VSSADMIN

Display the current volume shadow copy backups and all installed shadow copy writers and providers.

Syntax
      Add a volume shadow copy storage association:
      VSSADMIN add shadowstorage /for=ForVolumeSpec /on=OnVolumeSpec [/maxsize=MaxSizeSpec]

      Create a new volume shadow copy:
      VSSADMIN create shadow /for=ForVolumeSpec [/autoretry=MaxRetryMinutes]

      Delete volume shadow copies:
      VSSADMIN delete shadows /for=ForVolumeSpec [/oldest | /all | /shadow=ShadowID] [/quiet]

      Delete volume shadow copy storage associations:
      VSSADMIN delete shadowstorage /for=ForVolumeSpec [/on=OnVolumeSpec] [/quiet]

      List registered volume shadow copy providers:
      VSSADMIN list providers

      List existing volume shadow copies:
      VSSADMIN list shadows [/for=ForVolumeSpec] [/shadow=ShadowID]

      List all shadow copy storage associations on the system:
      VSSADMIN list shadowstorage {/for=ForVolumeSpec | /on=OnVolumeSpec}

      List volumes that are eligible for shadow copies:
      VSSADMIN list volumes

      List all subscribed volume shadow copy writers on the system:
      VSSADMIN list writers

      Resize the maximum size for a shadow copy storage association:
      VSSADMIN resize shadowstorage /for=ForVolumeSpec /on=OnVolumeSpec [/maxsize=MaxSizeSpec]
             ** Resizing the storage association may cause shadow copies to disappear.

Key
   /all                Delete all of the shadow copies for the specified volume.

   /autoretry=MaxRetryMinutes
                       The maximum amount of time (in minutes) during which the vssadmin command will attempt
                       to create the shadow copy, if another process is simultaneously attempting to create a shadow copy.

   /for=ForVolumeSpec  The volume for which the shadow copy storage operation is intended.

   /on=OnVolumeSpec    The volume to be used as storage for the volume that is defined in the /for parameter.

   /maxsize=MaxSizeSpec The max amount of storage space FOR the volume specified in /on.
                       If MaxSizeSpec is not specified, there is no limit placed on the space to be used.
                       If the max. number of shadow copy storage associations have already been made, an
                       error is returned. MaxSizeSpec must be 300 MB or greater and it must be expressed
                       in one of the following units: bytes, KB, MB, GB, TB, PB, or EB.
                       These units can be abbreviated as B, K, M, G, T, P, and E, respectively.
                       If no unit is specified, MaxSizeSpec uses bytes (B) by default.

   /oldest             Delete only the oldest shadow copy.

   /shadow=ShadowID    Delete the shadow copy specified by ShadowID. 

   ShadowID            To get the shadow copy ID, use the VSSADMIN list shadows command.
                       When you type a shadow copy ID, use the following format, where
                       each X represents a hexadecimal character: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX

   /quiet              Suppress messages.

To enable VSS on a volume. Right-click on the volume and select Properties ➞ Shadow Copies. From here, you can then click Enable to create the first snapshot.

Shadow copies are exposed to PowerShell by a WMI class called Win32_ShadowCopy.

Examples

Specify that for volume C, volume D is to be used for storage and the maximum size for storage space is to be 900 MB

VSSADMIN add shadowstorage /for=c: /on=d: /maxsize=900mb

Create a shadow copy of volume C:

VSSADMIN create shadow /for=c:

Delete the oldest shadow copy of volume C:

VSSADMIN delete shadows /for=c: /oldest

Create a shadow copy with PowerShell, requires elevation. If this returns no result then no instances of win32_shadowcopy exist. This is normal behaviour. [source]

# get existing shadow copies 
$shadow = Get-CIMinstance win32_shadowcopy
 "There are {0} shadow copies on this sytem" -f $shadow.count ""
# get static method
$class=[WMICLASS]"root\cimv2:win32_shadowcopy"
# create a new shadow copy 
"Creating a new shadow copy" 
$class.create("E:\", "ClientAccessible")  

# Count again 
$shadow = Get-CIMinstance win32_shadowcopy 
 "There are now {0} shadow copies on this sytem" -f $shadow.count

Create a shadow copy with a single line of PowerShell:

(Get-CIMinstance -list win32_shadowcopy).Create('E:\','ClientAccessible')

Create a shadow copy with WMIC:

WMIC shadowcopy call create Volume='E:\'

“You are on a soulful path that asks you to step into the greatest version of yourself. It is a sacred gift to shine your brightest light, not just in your moments of glory, but each day” ~ Debbie Ford

Related commands

PowerShell Script - Delete shadow copies over 30 days old.
DISKSHADOW - Volume Shadow Copy Service.
WBADMIN - Windows Backup Admin.
Renaming vssadmin.exe - Hide VSSADMIN from Crypto Ransomware.


 
Copyright © 1999-2024 SS64.com
Some rights reserved