Windows backup types #windows #backup #disk #blog
Related to Windows Desktop OS
Verdict
Create: SystemPropertiesProtection.exe
Restore: rstrui.exe
NOTE: In my Windows PRO 10 (10.0.14393 N/A Build 14393) tests it was not possible to restore any restore point, but I was able to see files when shadow was mounted.
<drive>\System Volume Information
by default. Can be moved to external drive with vssadmin add shadowstorage /for=d: /on=e:
cinst shadowexplorer
).# interactive
vssadmin list shadows
cmd /c "mklink /d c:\shadow <volume_from_list>\" # note: must have trailing \
# non-interactive
function mount-shadow($name) {
Get-ComputerRestorePoint | ? Description -eq $name | % SequenceNumber | set s
$mount_path = "c:\" + ($name -replace '[ :\\/?]', '-')
cmd /c "mklink /d $mount_path \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy$($s-1)\"
cd $mount_path
}
mount-shadow 'test 1'
Enable-ComputerRestore -drive "c:\"
Get-ComputerRestorePoint
Checkpoint-Computer -Description "My first checkpoint" -Restorepointtype "Modify_Settings"
# This must be set beause of the message
# 'A new system restore point cannot be created because one has already been created within the past 1440 minutes'
sp 'HKLM:\Software\Microsoft\Windows NT\CurrentVersion\SystemRestore' SystemRestorePointCreationFrequency 1 # Use number of minutes instead 1, 0 is allowed
Restore-Computer -RestorePoint 59 -whatif
# Remove is not available OTB, use https://goo.gl/jRoclF
Get-ComputerRestorePoint | ? Description -eq 'test' | Delete-ComputerRestorePoint
# TO delete vssadmin can be used OTB
vssadmin delete shadows /Shadow=<ShadowId>
# WMI
# See https://msdn.microsoft.com/en-us/library/aa394428(v=vs.85).aspx
$shadows = Get-WmiObject Win32_ShadowCopy | select DeviceObject, Id, @{ N='installDate'; E={ [DateTime]::ParseExact(($_.InstallDate -replace '\..+'), "yyyyMMddHHmmss", $null)}, @{ N='wmi', E={$_} }
$shadows #show, there is no description, identify by date which is around ~10s later then that reported by `Get-ComputerRestorePoint`.
$shadows[-1].wmi.Delete() #delete the last shadow
# WMI create
# see https://msdn.microsoft.com/en-us/library/aa389391(v=vs.85).aspx
(Get-WmiObject -List Win32_ShadowCopy).Create("C:\", "ClientAccessible")
# or
$class=[WMICLASS]"root\cimv2:win32_shadowcopy"
$class.create("C:\", "ClientAccessible")
# NOTE: Those are not visible by the Get-ComputerRestorePoint or rstrui.exe, but only vssadmin and WMI. There doesn't seem a way to restore them OTB !!!
# get available contexts
Get-WmiObject win32_shadowcontext | Out-GridView
PS> vssadmin list shadowstorage
Shadow Copy Storage association
For volume: (C:)\\?\Volume{7ff35979-24a6-4b98-ac45-48b7acc35892}\
Shadow Copy Storage volume: (C:)\\?\Volume{7ff35979-24a6-4b98-ac45-48b7acc35892}\
Used Shadow Copy Storage space: 3.98 GB (1%)
Allocated Shadow Copy Storage space: 4.38 GB (1%)
Maximum Shadow Copy Storage space: 10.0 GB (4%)
control /name Microsoft.BackupAndRestore
Get-ScheduledTask | ? TaskName -eq AutomaticBackup
control /name Microsoft.FileHistory
File History only backs up copies of files that are in the Documents, Music, Pictures, Videos, and Desktop folders and the OneDrive files available offline on your PC. If you have files or folders elsewhere that you want backed up, you can add them to one of these folders.
$HOME
folder:
$HOME
.mklink
in $HOME
doesnt include that folder. Adding hardlink works but hardlinks are by default possible only on files so script must be made to recreate directory structure.<disk>\FileHistory\<user>\<computer>\Data\C\Users\<user>
. Adds UTC time as suffix to file names.$env:SystemRoot\System32\FileHistory.exe
. App has very bad interface and looks unusuable with big number of versions. Its way better to just browse \FileHistory directly.<disk>\FileHistory\<user>\<computer0\Configuration
. Adding random folder there outside of the $HOME doesn't work.