{"id":9491,"date":"2012-05-08T00:01:00","date_gmt":"2012-05-08T00:01:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2012\/05\/08\/use-powershell-to-back-up-system-state-prior-to-making-changes\/"},"modified":"2012-05-08T00:01:00","modified_gmt":"2012-05-08T00:01:00","slug":"use-powershell-to-back-up-system-state-prior-to-making-changes","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/use-powershell-to-back-up-system-state-prior-to-making-changes\/","title":{"rendered":"Use PowerShell to Back Up System State Prior to Making Changes"},"content":{"rendered":"<p><b>Summary<\/b>: Learn how to use Windows PowerShell to back up system state prior to making changes to the registry.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/q-for-powertip.jpg\" alt=\"Hey, Scripting Guy! Question\" \/>&nbsp;Hey, Scripting Guy! I am interested in using Windows PowerShell to work with the registry, but everything I see talks about backing up the registry first. Is it possible to use Windows PowerShell to back up the registry?<\/p>\n<p>&mdash;CG<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/a-for-powertip.jpg\" alt=\"Hey, Scripting Guy! Answer\" \/>&nbsp;Hello CG,<\/p>\n<p>Microsoft Scripting Guy, Ed Wilson, is here. Things are really becoming exciting around here. I have been in contact with <a href=\"http:\/\/blogs.technet.com\/b\/heyscriptingguy\/archive\/2012\/05\/01\/winners-of-the-2012-powershell-scripting-games-announced.aspx\" target=\"_blank\">the two winners from the 2012 Scripting Games<\/a>, Rohn Edwards and Lido Paglia, and they are both coming to <a href=\"http:\/\/northamerica.msteched.com\/?mtag=scriptingguys#fbid=a7P5-eOcwVC\" target=\"_blank\">Microsoft TechEd 2012<\/a>. I will later announce a time when they will be at the Scripting Guys booth, so if you are in Orlando at TechEd 2012, make sure that you can stop by. In addition, I have been talking to my good friend, Blaine Barton, who does the IT Time TechNet Radio podcast, and we will be doing a live broadcast from the TechEd floor as we talk to Rohn and Lido. This is not all&mdash; I will make sure to announce any other cool things we come up with.<\/p>\n<p><b>Note<\/b>&nbsp;&nbsp;&nbsp;This is the second blog in a series of Hey, Scripting Guy! Blogs that discuss using the Registry provider. The first blog, <a href=\"http:\/\/blogs.technet.com\/b\/heyscriptingguy\/archive\/2012\/05\/07\/use-the-powershell-registry-provider-to-simplify-registry-access.aspx\" target=\"_blank\">Using the Registry Provider to Simply Registry Access<\/a> published on Monday. For additional information about working with the registry via Windows PowerShell, <a href=\"http:\/\/blogs.technet.com\/b\/heyscriptingguy\/archive\/tags\/windows+powershell\/operating+system+\/registry\/\" target=\"_blank\">see this collection of blogs<\/a>.<\/p>\n<h2>Understanding the Computer Restore cmdlets<\/h2>\n<p>One of the easiest ways to ensure system reliability is to create a restore point prior to making potentially damaging changes. In this way, if a problem arises, it is rather simple to roll back the changes. In Windows PowerShell, the easy way to create a restore point is to use the Windows PowerShell cmdlets. These cmdlets require administrator rights (due to access to protected registry keys and other vital configuration files). Therefore, you need to right-click the Windows PowerShell icon and select <b>Run As Administrator<\/b><i> <\/i>from the Action menu. Keep in mind that these cmdlets only work on client systems later than Windows&nbsp;XP. These cmdlets do not work on server versions of the operating system. There are several cmdlets that you can use to work with system restore. These cmdlets and their associated descriptions are listed here.<\/p>\n<\/p>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td width=\"319\" valign=\"top\">\n<p><b>Name<\/b><\/p>\n<\/td>\n<td width=\"319\" valign=\"top\">\n<p><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Synopsis<\/b><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td width=\"319\" valign=\"top\">\n<p>Enable-ComputerRestore<\/p>\n<\/td>\n<td width=\"319\" valign=\"top\">\n<p>Enables the System Restore feature on the specified file system drive.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td width=\"319\" valign=\"top\">\n<p>Disable-ComputerRestore<\/p>\n<\/td>\n<td width=\"319\" valign=\"top\">\n<p>Disables the System Restore feature on the specified file system drive.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td width=\"319\" valign=\"top\">\n<p>Get-ComputerRestorePoint<\/p>\n<\/td>\n<td width=\"319\" valign=\"top\">\n<p>Gets the restore points on the local computer.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td width=\"319\" valign=\"top\">\n<p>Restore-Computer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/p>\n<\/td>\n<td width=\"319\" valign=\"top\">\n<p>Starts a system restore on the local computer.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td width=\"319\" valign=\"top\">\n<p>Checkpoint-Computer&nbsp;&nbsp;<\/p>\n<\/td>\n<td width=\"319\" valign=\"top\">\n<p>Creates a system restore point on the local computer.<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p><b>Note<\/b>&nbsp;&nbsp;&nbsp;The following command retrieved the information in the previous table:<\/p>\n<p style=\"padding-left: 30px\">&#8220;*restore*&#8221;,&#8221;checkpoint*&#8221; | % {get-help $_ }| select name, synopsis | ft -AutoSize &ndash;Wrap<\/p>\n<p>The good thing is that the *restore* cmdlets use a standard WMI class: the <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/windows\/desktop\/aa378951(v=vs.85).aspx\" target=\"_blank\">SystemRestore WMI class<\/a>. This class has documentation on MSDN, so MSDN is a great place to find additional information about the Windows PowerShell cmdlets.<\/p>\n<h2>Use CheckPoint-Computer to create a restore point<\/h2>\n<p>To create a new restore point, you use the <b>CheckPoint-Computer<\/b> cmdlet. If the name of this cmdlet bothers you, you can create an alias to <b>New-ComputerRestorePoint<\/b> by using the <b>New-Alias<\/b> cmdlet as shown here.<\/p>\n<p style=\"padding-left: 30px\">new-alias -Name New-ComputerRestorePoint -Value Checkpoint-Computer<\/p>\n<p>When creating a new restore point via the <b>CheckPoint-Computer<\/b> cmdlet, you can specify one of five values for the <i>RestorePointType <\/i>parameter. The values are shown here.<\/p>\n<\/p>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td width=\"213\" valign=\"top\">\n<p><b>Name<\/b><\/p>\n<\/td>\n<td width=\"64\" valign=\"top\">\n<p><b>Value<\/b><\/p>\n<\/td>\n<td width=\"361\" valign=\"top\">\n<p><b>Meaning<\/b><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td width=\"213\" valign=\"top\">\n<p>APPLICATION_INSTALL<\/p>\n<\/td>\n<td width=\"64\" valign=\"top\">\n<p>0<\/p>\n<\/td>\n<td width=\"361\" valign=\"top\">\n<p>An application has been installed.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td width=\"213\" valign=\"top\">\n<p>APPLICATION_UNINSTALL<\/p>\n<\/td>\n<td width=\"64\" valign=\"top\">\n<p>1<\/p>\n<\/td>\n<td width=\"361\" valign=\"top\">\n<p>An application has been uninstalled.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td width=\"213\" valign=\"top\">\n<p>CANCELLED_OPERATION<\/p>\n<\/td>\n<td width=\"64\" valign=\"top\">\n<p>13<\/p>\n<\/td>\n<td width=\"361\" valign=\"top\">\n<p>An application needs to delete the restore point it created. For example, an application would use this flag when a user cancels an installation.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td width=\"213\" valign=\"top\">\n<p>DEVICE_DRIVER_INSTALL<\/p>\n<\/td>\n<td width=\"64\" valign=\"top\">\n<p>10<\/p>\n<\/td>\n<td width=\"361\" valign=\"top\">\n<p>A device driver has been installed.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td width=\"213\" valign=\"top\">\n<p>MODIFY_SETTINGS<\/p>\n<\/td>\n<td width=\"64\" valign=\"top\">\n<p>12<\/p>\n<\/td>\n<td width=\"361\" valign=\"top\">\n<p>An application has had features added or removed.<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p>The default value for the <i>RestorePointType <\/i>parameter is APPLICATION_INSTALL. Therefore, leaving the <i>RestorePointType <\/i>parameter out of the command causes the cmdlet to create this type of restore point.<\/p>\n<p>Because you are getting ready to modify the registry, you can use the default <i>RestorePointType <\/i>value. This command is shown here.<\/p>\n<p style=\"padding-left: 30px\">Checkpoint-Computer -Description &#8220;prior to adding registry key&#8221;<\/p>\n<p>You can use the <b>Get-ComputerRestorePoint<\/b> cmdlet to obtain a list of the most recent computer restore points. This command is shown here.<\/p>\n<p style=\"padding-left: 30px\">PS C:\\&gt; Get-ComputerRestorePoint<\/p>\n<p><b>Warning<\/b>&nbsp;&nbsp;&nbsp;Column &#8220;RestorePointType&#8221; does not fit into the display and it was removed.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"padding-left: 30px\">CreationTime&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Description&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SequenceNumber&nbsp;&nbsp;&nbsp; EventType<\/p>\n<p style=\"padding-left: 30px\">&#8212;&#8212;&#8212;&#8212;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8212;&#8212;&#8212;&#8211;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8212;&#8212;&#8212;&#8212;&#8211;&nbsp;&nbsp;&nbsp; &#8212;&#8212;&#8212;<\/p>\n<p style=\"padding-left: 30px\">4\/17\/2012 4:51:37 PM&nbsp;&nbsp; Windows Update&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 38&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BEGIN_SYS&#8230;<\/p>\n<p style=\"padding-left: 30px\">4\/19\/2012 3:53:55 PM&nbsp;&nbsp; Windows Update&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 39&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BEGIN_SYS&#8230;<\/p>\n<p style=\"padding-left: 30px\">4\/19\/2012 3:57:07 PM&nbsp;&nbsp; Windows Live Essentials&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 40&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BEGIN_SYS&#8230;<\/p>\n<p style=\"padding-left: 30px\">4\/19\/2012 3:57:19 PM&nbsp;&nbsp; Installed DirectX&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 41&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BEGIN_SYS&#8230;<\/p>\n<p style=\"padding-left: 30px\">4\/19\/2012 3:57:24 PM&nbsp;&nbsp; Installed DirectX&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 42&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BEGIN_SYS&#8230;<\/p>\n<p style=\"padding-left: 30px\">4\/19\/2012 3:57:48 PM&nbsp;&nbsp; WLSetup&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 43&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BEGIN_SYS&#8230;<\/p>\n<p style=\"padding-left: 30px\">4\/24\/2012 9:11:12 AM&nbsp;&nbsp; Windows Update&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 44&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BEGIN_SYS&#8230;<\/p>\n<p style=\"padding-left: 30px\">4\/25\/2012 1:48:52 PM&nbsp;&nbsp; Windows Update&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 45&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BEGIN_SYS&#8230;<\/p>\n<p style=\"padding-left: 30px\">4\/29\/2012 9:43:11 AM&nbsp;&nbsp; Windows Update&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 46&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BEGIN_SYS&#8230;<\/p>\n<p style=\"padding-left: 30px\">4\/30\/2012 11:27:01 AM&nbsp; Installed Microsoft&nbsp; File T&#8230; 47&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BEGIN_SYS&#8230;<\/p>\n<p style=\"padding-left: 30px\">5\/2\/2012 10:51:17 AM&nbsp;&nbsp; Installed Intel(R) PROSet\/W&#8230; 48&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BEGIN_SYS&#8230;<\/p>\n<p style=\"padding-left: 30px\">5\/2\/2012 10:04:24 PM&nbsp;&nbsp; Windows Update&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 50&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BEGIN_SYS&#8230;<\/p>\n<p style=\"padding-left: 30px\">5\/4\/2012 10:22:41 AM&nbsp;&nbsp; Windows Update&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 51&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BEGIN_SYS&#8230;<\/p>\n<p style=\"padding-left: 30px\">5\/7\/2012 12:01:48 PM&nbsp;&nbsp; Windows Update&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 52&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BEGIN_SYS&#8230;<\/p>\n<p style=\"padding-left: 30px\">5\/7\/2012 2:02:12 PM&nbsp;&nbsp;&nbsp; prior to adding registry key&nbsp;&nbsp; 53&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BEGIN_SYS&#8230;<\/p>\n<h2>Verifying the status of the last restore point<\/h2>\n<p>Unfortunately, this command provides no information about the success of the last attempt to create a restore point for the computer. Selecting the most recent checkpoint and sending the output to the <b>Format-List<\/b> cmdlet with the <i>Force <\/i>parameter, displays additional information, but it does not provide any information about the success or failure of the checkpoint. This command and associated output are shown here.<\/p>\n<p style=\"padding-left: 30px\">PS C:\\&gt; Get-ComputerRestorePoint -RestorePoint 53 | fl * -Force<\/p>\n<p style=\"padding-left: 30px\">__GENUS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;: 2<\/p>\n<p style=\"padding-left: 30px\">__CLASS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : SystemRestore<\/p>\n<p style=\"padding-left: 30px\">__SUPERCLASS&nbsp;&nbsp;&nbsp;&nbsp; :<\/p>\n<p style=\"padding-left: 30px\">__DYNASTY&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : SystemRestore<\/p>\n<p style=\"padding-left: 30px\">__RELPATH&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : SystemRestore.SequenceNumber=53<\/p>\n<p style=\"padding-left: 30px\">__PROPERTY_COUNT : 5<\/p>\n<p style=\"padding-left: 30px\">__DERIVATION&nbsp;&nbsp;&nbsp;&nbsp; : {}<\/p>\n<p style=\"padding-left: 30px\">__SERVER&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : EDLT<\/p>\n<p style=\"padding-left: 30px\">__NAMESPACE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : root\\default<\/p>\n<p style=\"padding-left: 30px\">__PATH&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;: \\\\EDLT\\root\\default:SystemRestore.SequenceNumber=53<\/p>\n<p style=\"padding-left: 30px\">CreationTime&nbsp;&nbsp;&nbsp;&nbsp; : 20120507180212.613222-000<\/p>\n<p style=\"padding-left: 30px\">Description&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : prior to adding registry key<\/p>\n<p style=\"padding-left: 30px\">EventType&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 100<\/p>\n<p style=\"padding-left: 30px\">RestorePointType : 0<\/p>\n<p style=\"padding-left: 30px\">SequenceNumber&nbsp;&nbsp; : 53<\/p>\n<p style=\"padding-left: 30px\">Scope&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : System.Management.ManagementScope<\/p>\n<p style=\"padding-left: 30px\">Path&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : \\\\EDLT\\root\\default:SystemRestore.SequenceNumber=53<\/p>\n<p style=\"padding-left: 30px\">Options&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : System.Management.ObjectGetOptions<\/p>\n<p style=\"padding-left: 30px\">ClassPath&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : \\\\EDLT\\root\\default:SystemRestore<\/p>\n<p style=\"padding-left: 30px\">Properties&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : {CreationTime, Description, EventType, RestorePointType&#8230;}<\/p>\n<p style=\"padding-left: 30px\">SystemProperties : {__GENUS, __CLASS, __SUPERCLASS, __DYNASTY&#8230;}<\/p>\n<p style=\"padding-left: 30px\">Qualifiers&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : {dynamic}<\/p>\n<p style=\"padding-left: 30px\">Site&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :<\/p>\n<p style=\"padding-left: 30px\">Container&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :<\/p>\n<p>The <b>Get-ComputerRestorePoint<\/b> cmdlet does have a <i>LastStatus <\/i>switched parameter, which according to Help, &ldquo;Gets the status of the most recent system restore operation.&rdquo; Unfortunately, the parameter provides only cryptic information such as shown here.<\/p>\n<p style=\"padding-left: 30px\">PS C:\\&gt; Get-ComputerRestorePoint -LastStatus | fl *<\/p>\n<p style=\"padding-left: 30px\">The last attempt to restore the computer failed.<\/p>\n<p>Without any dates, operation IDs or other detailed information, the <i>LastStatus <\/i>parameter cannot be relied on to make a decision in relation to the success or failure of the computer&rsquo;s system restore point.<\/p>\n<h2>See the Event Log for restore point status<\/h2>\n<p>The best place to determine the success (or failure) of the attempt to create a restore point for the computer is the <i>Application <\/i>Event Log. The pertinent event (event ID 8194) is shown here.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/7750.hsg-5-8-12-01.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/7750.hsg-5-8-12-01.png\" alt=\"Image of event\" title=\"Image of event\" \/><\/a><\/p>\n<p>Because you already have Windows PowerShell open, it is much faster to use the <b>Get-EventLog<\/b> cmdlet to obtain this information than to open the Event Viewer utility, navigate to the Windows Logs, select the Application log, and find the 8194 events in the log viewer. The command to find the latest 8194 event from the application log is shown here.<\/p>\n<p style=\"padding-left: 30px\">Get-EventLog -LogName application -InstanceId 8194 -Newest 1 | fl *<\/p>\n<p>The command and the associated output are shown in the image that follows.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/1374.hsg-5-8-12-02.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/1374.hsg-5-8-12-02.png\" alt=\"Image of command output\" title=\"Image of command output\" \/><\/a><\/p>\n<p>CG, that is all there is to using the <b>CheckPoint-Computer<\/b> cmdlet to create a system restore point and back up the registry. Registry Week will continue tomorrow when I will talk about creating new Registry keys and property values via the Windows PowerShell Registry provider.<\/p>\n<p>I invite you to follow me on <a href=\"http:\/\/bit.ly\/scriptingguystwitter\" target=\"_blank\">Twitter<\/a> and <a href=\"http:\/\/bit.ly\/scriptingguysfacebook\" target=\"_blank\">Facebook<\/a>. If you have any questions, send email to me at <a href=\"mailto:scripter@microsoft.com\" target=\"_blank\">scripter@microsoft.com<\/a>, or post your questions on the <a href=\"http:\/\/bit.ly\/scriptingforum\" target=\"_blank\">Official Scripting Guys Forum<\/a>. See you tomorrow. Until then, peace.<\/p>\n<p><b>Ed Wilson, Microsoft Scripting Guy<\/b>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Summary: Learn how to use Windows PowerShell to back up system state prior to making changes to the registry. &nbsp;Hey, Scripting Guy! I am interested in using Windows PowerShell to work with the registry, but everything I see talks about backing up the registry first. Is it possible to use Windows PowerShell to back up [&hellip;]<\/p>\n","protected":false},"author":596,"featured_media":87096,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[51,31,26,3,4,45],"class_list":["post-9491","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","tag-getting-started","tag-operating-system","tag-registry","tag-scripting-guy","tag-scripting-techniques","tag-windows-powershell"],"acf":[],"blog_post_summary":"<p>Summary: Learn how to use Windows PowerShell to back up system state prior to making changes to the registry. &nbsp;Hey, Scripting Guy! I am interested in using Windows PowerShell to work with the registry, but everything I see talks about backing up the registry first. Is it possible to use Windows PowerShell to back up [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/9491","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/users\/596"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/comments?post=9491"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/9491\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media\/87096"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media?parent=9491"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=9491"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=9491"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}