Diskshadow command in Windows

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).

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.

For 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:

  1. You have an existing folder named C: diskshadowdata.
  2. Your system drive is C: and your data drive is D :.
  3. You have a backupscript.cmd file in C: diskshadowdata.
  4. Your backupscript.cmd file will copy the hidden data p: and q: to the backup drive.

You can manually enter these commands or use the following script:

 #diskshadow script file set context persistent nowriters set metadata c:diskshadowdataexample.cab set verbose on begin backup add volume c: alias Systemvolumeshadow add volume d: alias Datavolumeshadow create expose %Systemvolumeshadow% p: expose %Datavolumeshadow% q: exec c:diskshadowdatabackupscript.cmd end backup #End of script 

See more:

  1. The dfsrmig command in Windows
  2. Diskcopy command in Windows
  3. Defrag command in Windows
4 ★ | 108 Vote