Clear, practical technology insights BSOD Code Lookup · Windows Error Code Lookup · Wi-Fi Troubleshooting · PC Troubleshooting Checklist

Diskshadow Command in Windows: Tips and Examples

Understand Diskshadow Command in Windows with clear explanations, practical examples, and useful tips. This updated guide covers the essential concepts and...

Table of Contents

Diskshadow Command in Windows is easier to understand when the core ideas are paired with practical examples. The sections below explain the topic clearly, highlight useful steps, and point out details that can prevent common errors.

Applies to : Windows Server (Semi-Annual Channel), Windows Server 2016, Windows Server 2012 R2, Windows Server 2012.

Diskshadow.exe is a tool that shows the functions provided by Volume Shadow Service (VSS). By default, the diskshadow command uses an interactive command interpreter, similar to diskraid or DiskPart. The diskshadow command also includes a Scriptable Mode ( writeable mode ).

Note:

As a local or equivalent administrator, the minimum required to run the diskshadow command .

For examples of how to use the diskshadow command , please see the Example below.

Syntax

With interactive mode, type the following command at the command prompt to start the diskshadow command interpreter :

 diskshadow 

With script mode (script mode), enter the following, in which script.txt is a script file containing diskshadow commands :

 diskshadow -s script.txt 

Diskshadow commands

You can run the following commands in the diskshadow command interpreter or through the script file:

ParametersDescriptionset_2 Set context, options, verbose mode and metadata files to create hidden copies. Simulate restore Check the writers' participation in recovery sessions on the computer without giving the writers PreRestore or PostRestore events. Load metadata Load the .cab metadata file before importing a hidden copy that can transmit, or download the writer's metadata, in case of recovery. writer Verify that a writer or a component is included or excluded from a writer or a component from the backup or restore procedure. add_1 Add a drive to the set of hidden copies or add aliases to the environment. create_1 Start the process of creating a shadow copy, using the current context and optional settings. exec Executes a file on the local computer. Begin backup Start a full backup session. End backup End a full backup session and issue a Backupcomplete event with the appropriate logging state, if needed. Begin restore Start a recovery session and offer a PreRestore event for the relevant writers. End restore End the recovery session and release the PostRestore event for the relevant writers. reset Reset the diskshadow command to the default state. list List writers, hidden copies, or registered hidden copy providers on the system. delete shadows Delete hidden copies. import Importing a hidden copy can transfer from the loaded metadata file into the system. mask Removes the hardware shadow copies that were imported using the import command . expose Shows a continuously hidden copy, such as a drive letter, shared or mount point. unexpose Hide a hidden copy from being revealed using the expose command. break_2 Unlink a hidden copy from VSS. revert Revert a drive back to a specified hidden copy. exit_1 Exit the diskshadow command .

Note

At a minimum, to create hidden copies, just adding and creating is enough. However, this will lose context and optional settings. It will be merely a backup and will only create a hidden copy without the script executing the backup command.

As an example,

This is a series of sample commands that will create a hidden copy for backup. It can be saved as a file in the form of script.dsh and executed with the diskshadow / s script.dsh script.

Assume the following:

  • You have an existing folder named C: diskshadowdata.
  • Your system drive is C: and your data drive is D:.
  • You have a backupscript.cmd file in C: diskshadowdata.
  • Your backupscript.cmd file will copy the hidden data p: and q: to the backup drive.
  • The dfsrmig command in Windows
  • Diskcopy command in Windows
  • Defrag command in Windows

FAQ

What should you know about syntax?

With interactive mode, type the following command at the command prompt to start the diskshadow command interpreter:

What should you know about diskshadow commands?

You can run the following commands in the diskshadow command interpreter or through the script file:

What should you know about note?

At a minimum, to create hidden copies, just adding and creating is enough. However, this will lose context and optional settings. It will be merely a backup and will only create a hidden copy without the script executing the backup command.

Discussion

Reader Comments 0

Sign in with email or Google to join the discussion.