Skip to content

Instantly share code, notes, and snippets.

@mkht
Created May 28, 2019 02:51
Show Gist options
  • Save mkht/c105421d51201c422c1a00678e0dce2e to your computer and use it in GitHub Desktop.
Save mkht/c105421d51201c422c1a00678e0dce2e to your computer and use it in GitHub Desktop.
$ErrorActionPreference = 'Stop'
$WarningPreference = 'Stop'
$Description = ('RestorePoint created by CRP task ({0})' -f [datetime]::Now.ToString('yyyy/MM/dd-hh:mm:ss'))
try {
Enable-ComputerRestore -Drive C:\
Checkpoint-Computer -Description $Description
}
catch {
exit 0x80040205 #INTERNALEXCEPTION
}
if ($?) {
exit 0x00 #SUCCESS
}
else {
exit 0x80040206 #INTERNALERROR
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment