Created
May 28, 2019 02:51
-
-
Save mkht/c105421d51201c422c1a00678e0dce2e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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