DISKSHADOW - CMD


Overview

DISKSHADOW is a command-line tool included in Windows operating systems that is designed for managing and manipulating Volume Shadow Copy Service (VSS) shadows. It is primarily used by administrators for creating, displaying, and deleting shadow copies, and for managing shadow copy storage space. This tool is essential for backup and disaster recovery scenarios, enabling user-initiated manual backups and restores of data at a specific point in time.

Syntax

The basic syntax for DISKSHADOW is:

DISKSHADOW [/s script] [/l logfile] [/q | /qw]
  • /s script: Executes commands from the specified script file.
  • /l logfile: Logs the session output to the specified log file.
  • /q: Executes DISKSHADOW in quiet mode, suppressing unnecessary output.
  • /qw: Executes DISKSHADOW in quiet mode but displays warnings.

Entering the DISKSHADOW environment:

To utilize DISKSHADOW for interactive commands, simply type DISKSHADOW and press Enter. This action opens the DISKSHADOW prompt where commands can be directly input.

Options/Flags

Inside the DISKSHADOW environment, various commands can be used:

  • LIST WRITERS: Lists all VSS writers available on the system.
  • LIST PROVIDERS: Displays all registered VSS providers.
  • LIST SHADOWS: Lists all shadow copies.
  • CREATE: Generates a new shadow copy.
  • DELETE SHADOWS: Removes shadow copies based on specific criteria.
  • IMPORT: Imports a shadow copy.
  • EXPORT: Exports a shadow copy.
  • RESET: Resets the VSS context by clearing all shadow copies and aborting current operations.

Examples

  1. Create a New Shadow Copy:

    DISKSHADOW
    > SET CONTEXT PERSISTENT
    > CREATE
    
  2. List All Shadow Copies:

    DISKSHADOW
    > LIST SHADOWS ALL
    
  3. Delete a Specific Shadow Copy:

    DISKSHADOW
    > DELETE SHADOWS ID {shadow-id}
    
  4. Using a Script to Automate Shadow Copies:
    Create a script file backup.dsh:

    SET CONTEXT PERSISTENT
    CREATE
    

    Run DISKSHADOW with the script:

    DISKSHADOW /s backup.dsh
    

Common Issues

  • Permission Errors: Ensure DISKSHADOW is run with administrative privileges to avoid permission-related issues.
  • Script Failures: Check script syntax and commands for errors if the script execution fails.
  • Resource Availability: Sometimes, shadow copy creation might fail due to insufficient storage space or other resource limitations. Ensuring adequate resources can mitigate this problem.

Integration

DISKSHADOW can be integrated with other CMD commands or scripts to automate complex backup tasks. For instance, combining it with ROBOCOPY to copy data to a backup location after creating a shadow copy:

DISKSHADOW /s backup.dsh
ROBOCOPY C:\data D:\backup_data /MIR
  • VSSADMIN: Useful for managing VSS and troubleshooting.
  • WMIC: Can interact with VSS providers and other system components programmatically.

For further reading and advanced options, Microsoft’s official documentation on DISKSHADOW provides a complete guide and detailed descriptions.