DiskShadow
https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/diskshadow
Diskshadow.exe is a command-line tool that exposes the functionality provided by the Volume Shadow Copy Service (VSS). Diskshadow is included in Windows Server 2008 or later as the first in-box VSS requester for hardware shadow copy scenarios.
DiskShadow.exe is a tool that exposes the functionality offered by the Volume Shadow Copy Service (VSS). By default, DiskShadow uses an interactive command interpreter similar to that of DiskRAID or DiskPart. DiskShadow also includes a scriptable mode.
Membership in the local Administrators group, or equivalent, is the minimum required to run DiskShadow.
For the command-line syntax for Diskshadow please refer to https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/diskshadow.
Example:
This example is backing up Windows 2008 R2 System State. The example script below takes a snapshot of the System writer components, exposes it as the Y drive, and writes a log to C:\temp\diskshadow-log.txt
SystemStateSnapshot1.txt (Script)
-----------------------------------------------------------------------------------------------------------------------------------------------
set verbose on
set context persistent
# Exclude other in-box writers
writer exclude {d61d61c8-d73a-4eee-8cdd-f6f9786b7124}
writer exclude {75dfb225-e2e4-4d39-9ac9-ffaff65ddf06}
writer exclude {0bada1de-01a9-4625-8278-69e735f39dd2}
writer exclude {66841cd4-6ded-4f4b-8f17-fd23f8ddc3de}
writer exclude {a65faa63-5ea8-4ebc-9dbd-a0c4db26912a}
writer exclude {be000cbe-11fe-4426-9c58-531aa6355fc4}
writer exclude {a6ad56c2-b509-4e6c-bb19-49d8f43532f0}
writer exclude {55f6d76d-8617-4fc8-81e9-df0de529b555}
writer exclude {542da469-d3e1-473c-9f4f-7847f01fc64f}
writer exclude {4dc3bdd4-ab48-4d07-adb0-3bee2926fd7f}
writer exclude {afbab4a2-367d-4d15-a586-71dbb18f8485}
writer exclude {4969d978-be47-48b0-b100-f328f07ac1e0}
writer exclude {35e81631-13e1-48db-97fc-d5bc721bb18a}
# Require System Writer
writer verify {e8132975-6f93-4464-a53e-1050253ae220}
# Take snapshot
begin backup
add volume c: alias vss_test_c
create
# Expose snapshot as drive y:
expose %vss_test_c% y:
end backup
-----------------------------------------------------------------------------------------------------------------------------------------------
Below is the command for DiskShadow utility, you need to run this from an elevated command prompt:
"diskshadow /s C:\SystemStateSnapshot1.txt /l c:\temp\diskshadow-log.txt"
To dismount the drive follow the steps below:
Note: This does not delete the shadow copy, it only unmounts the volume so the Volume Shadow copy framework can delete the snapshot as needed.
To modify this script to access different writers run “Vssadmin List Writers” from a command prompt, and include the GUID for the "Writer ID" you want to backup. Do not include multiple writers in the included components.