Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: [CMD] Create Consistent Copy of your registry using VSS

16 May 2015   #1
tweakradje

win7
 
 
[CMD] Create Consistent Copy of your registry using VSS

This script uses VSS (also on workstations!) to create a Live backup of your registry.

Code:
@echo off
REM
REM Tweakradje 2015 v1.3
REM 
Cls
Title Creating Volume Snapshot for Live Registry Backup

Echo.
Echo Creating Volume Snapshot...
Echo.

REM Wmic.exe shadowcopy call create ClientAccessible,"C:\"
REM Executing (Win32_ShadowCopy)->create()
REM Method execution successful.
REM Out Parameters:
REM instance of __PARAMETERS
REM {
REM         ReturnValue = 0;
REM         ShadowID = "{7F3058E6-79A6-47D7-A6F9-04AF456ABEF1}";
REM };

For /f "tokens=3" %%s in ('"Wmic.exe shadowcopy call create ClientAccessible,"C:\""^|Findstr ShadowID') Do Call :CopyRegistry %%s
Pause
Exit /b %%s

:CopyRegistry
REM %1 like "{4BA387DD-5A18-4BFA-BBCB-071560ABC77E}";
Set VSSID=%~1
REM Check if left char is a {
If Not (%VSSID:~,1%) == ({) Echo "No valid Snapshot made!" & Exit /b
Echo.
Echo Snapshot succes. (ID %VSSID%)
Echo.
REM vssadmin list shadows /Shadow={a759180d-6bbe-4aaf-b3aa-57d219aa3e88}
REM vssadmin 1.1 - Volume Shadow Copy Service administrative command-line tool
REM (C) Copyright 2001-2005 Microsoft Corp.
REM 
REM Contents of shadow copy set ID: {caf5cc6b-0c9d-4f88-abe8-83f89faf96bf}
REM    Contained 1 shadow copies at creation time: 16-5-2015 15:44:13
REM       Shadow Copy ID: {a759180d-6bbe-4aaf-b3aa-57d219aa3e88}
REM          Original Volume: (C:)\\?\Volume{2bfd2d95-a745-11e4-9803-806e6f6e6963}\
REM          Shadow Copy Volume: \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy23
REM          Originating Machine: ASUS
REM          Service Machine: ASUS
REM          Provider: 'Microsoft Software Shadow Copy provider 1.0'
REM          Type: ClientAccessible
REM          Attributes: Persistent, Client-accessible, No auto release, No writers, Differential

REM Get the Shadow Copy Volume, Find the line in output with GLOBALROOT, divide line by : and take 2nd part

For /f "tokens=2 delims=:" %%s in ('"vssadmin.exe list shadows /Shadow=%VSSID%"^|FindStr GLOBALROOT') Do Set VSSVOL=%%s

Echo.
Echo Copying Registry files from %VSSVOL% to C:\Temp
Echo.

Echo|SET /p=software & Copy /Y %VSSVOL%\Windows\System32\Config\software c:\temp\hklm_software
Echo|SET /p=system & Copy /Y %VSSVOL%\Windows\System32\Config\system c:\temp\hklm_system
Echo|SET /p=components & Copy /Y %VSSVOL%\Windows\System32\Config\components c:\temp\hklm_components
Echo|SET /p=security & Copy /Y %VSSVOL%\Windows\System32\Config\security c:\temp\hklm_security
Echo|SET /p=sam & Copy /Y %VSSVOL%\Windows\System32\Config\sam c:\temp\hklm_sam
Echo|SET /p=default & Copy /Y %VSSVOL%\Windows\System32\Config\default c:\temp\hkcu_default
Echo|SET /p=LocalService & Copy /Y %VSSVOL%\Windows\ServiceProfiles\LocalService\ntuser.dat c:\temp\hku_localservice
Echo|SET /p=NetworkService & Copy /Y %VSSVOL%\Windows\ServiceProfiles\NetworkService\ntuser.dat c:\temp\hku_networkservice
Echo|SET /p=SystemProfile & Copy /Y %VSSVOL%\Windows\System32\config\systemprofile\ntuser.dat c:\temp\hku_system
Echo|SET /p=CurrentUser (%USERNAME%) & Copy /Y %VSSVOL%\%USERPROFILE:~3%\ntuser.dat c:\temp\hku_%USERNAME%
Echo|SET /p=CurrentUser Classes & Copy /Y %VSSVOL%\%LOCALAPPDATA:~3%\Microsoft\Windows\UsrClass.dat c:\temp\hku_%USERNAME%_classes

Echo.
Echo Done. Removing VSS Snapshot (ID %VSSID%)...
Echo.
vssadmin.exe  delete Shadows /Shadow=%VSSID% /Quiet >nul
If %errorlevel% == 1 (
	Echo "Snapshot ID %VSSID% not deleted!"
) Else (
	Echo "Snapshot succesfully removed."
)

Exit /b



My System SpecsSystem Spec
.
09 Jun 2015   #2
JustCall

Windows 8.1 Pro 64bit
 
 

Never seen something like this before. Great work!
My System SpecsSystem Spec
10 Jun 2015   #3
tweakradje

win7
 
 

Dank je!

Maybe take a look at my wmi tool too in this section.

I hope to inspire
My System SpecsSystem Spec
.

10 Jun 2015   #4
JustCall

Windows 8.1 Pro 64bit
 
 

Haha bedankt!
My System SpecsSystem Spec
Reply

 [CMD] Create Consistent Copy of your registry using VSS




Thread Tools Search this Thread
Search this Thread:

Advanced Search




Similar help and support threads
Thread Forum
Can you copy a WinXP Pro registry entry into Win 7 registry
Hello, Background: 1. I have a program I use always, I have the install disks and can install it on Win 7 Pro x64. It is a 32 bit program. However, this program had a critical patch issued as a download way back when and this patch cannot be installed on the 7 system, because the installer is...
General Discussion
How can i create this registry entry? (regarding sdelete)
And run the following reg-file. Code: Windows Registry Editor Version 5.00 @="\"C:\\Program files\\sdelete.exe\" \"%1\"" This will create a right click menu for all files. ______________ I have placed the sdelete folder in C program files but im not sure what to do after that. Thanks...
General Discussion
create copy-protect
hi guys i have a clip to write on a DVD but i want that no one can copy that DVD. i know that all ways off copy-protection can be broke...but what is the best software to do this?
Software
What if I copy someone else's registry files?
My Win7 home premium 64bit registry is corrupt. I've tried repairing it using System Recovery Options and Startup Repair 3 times but they didn't work. I've tried to copy the files from windows32/system/config/regback to windows32/system/config still no luck (the back-up files seem to be more...
Backup and Restore
What W7 Processes Create Shadow Copy?
What processes or services does Windows 7 Home Premium use to create a HarddiskVolumeShadowCopy? I know that W7 backup does this but are there other automated W7 processes that do this? Is there any way to disable these or make them manual? I have a problem with NIS 2011 alerting to a...
Backup and Restore
How to create an autostart key in the registry
I have problem with appearance of language bar, there for I would like to learn step by step how to create an auto start key in the registry (HKLM\Software\Microsoft\Windows\CurrentVersion\Run) and which number should I put in the value box? I'll appreciate your support Best regards
General Discussion


Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 19:39.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App