<p>Is it "taboo" to programatically create system restore points?  I would be doing this before I perform a software update.  If there is a better method to create a restore point with just my software's files and data, please let me know.</p>

<p>I would like a means by which I can get the user back to a known working state if everything goes kaput during an update (closes/kills the update app, power goes out, user pulls the plug, etc.)</p>

<pre><code>    private void CreateRestorePoint(string description)
    {
        ManagementScope oScope = new ManagementScope("\\\\localhost\\root\\default");
        ManagementPath oPath = new ManagementPath("SystemRestore");
        ObjectGetOptions oGetOp = new ObjectGetOptions();
        ManagementClass oProcess = new ManagementClass(oScope, oPath, oGetOp);

        ManagementBaseObject oInParams = oProcess.GetMethodParameters("CreateRestorePoint");
        oInParams["Description"] = description;
        oInParams["RestorePointType"] = 12; // MODIFY_SETTINGS
        oInParams["EventType"] = 100;

        ManagementBaseObject oOutParams = oProcess.InvokeMethod("CreateRestorePoint", oInParams, null); 
    }
</code></pre>

[{'answer_id': 32854, 'author': 'EBGreen', 'author_id': 1358, 'author_profile': 'https://Stackoverflow.com/users/1358', 'pm_score': -1, 'selected': False, 'text': "<p>I don't think a complete system restore would be a good plan. Two reasons that quickly come to mind:</p>\n\n<ul>\n<li>Wasted disk space</li>\n<li>Unintended consequences from a rollback</li>\n</ul>\n"}, {'answer_id': 32874, 'author': 'Greg Hurlman', 'author_id': 35, 'author_profile': 'https://Stackoverflow.com/users/35', 'pm_score': 2, 'selected': False, 'text': "<p>No, it's not Taboo - in fact, I'd encourage it.  The OS manages how much hard drive takes, and I'd put money down on Microsoft spending more money &amp; time testing System Restore than you the money &amp; time you're putting into testing your setup application.</p>\n"}, {'answer_id': 32893, 'author': 'Misha M', 'author_id': 3467, 'author_profile': 'https://Stackoverflow.com/users/3467', 'pm_score': 0, 'selected': False, 'text': '<p>Take a look at the following link:  <a href="http://www.calumgrant.net/atomic/" rel="nofollow noreferrer">http://www.calumgrant.net/atomic/</a></p>\n\n<p>The author described "Transactional Programming".  This is analogous to the transactions in data bases.</p>\n\n<p>Example:</p>\n\n<p>Start transaction:</p>\n\n<ol>\n<li>Step 1</li>\n<li>Step 2</li>\n<li>Encounter error during step 2</li>\n<li>Roll back to before transaction started.</li>\n</ol>\n\n<p>This is a new framework, but you can look at it more as a solution rather then using the framework.</p>\n\n<p>By using transactions, you get the "Restore Points" that you\'re looking for.</p>\n'}, {'answer_id': 32933, 'author': 'The How-To Geek', 'author_id': 291, 'author_profile': 'https://Stackoverflow.com/users/291', 'pm_score': 1, 'selected': False, 'text': '<p>If you are developing an application for Vista you can use Transactional NTFS, which supports a similar feature to what you are looking for.</p>\n\n<p><a href="http://en.wikipedia.org/wiki/Transactional_NTFS" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Transactional_NTFS</a></p>\n\n<p>Wouldn\'t installer packages already include this type of rollback support, though? I\'m not terribly familiar with most of them so I am not sure.</p>\n\n<p>Finally, Windows will typically automatically create a restore point anytime you run a setup application.</p>\n'}, {'answer_id': 32989, 'author': 'Adam Wright', 'author_id': 1200, 'author_profile': 'https://Stackoverflow.com/users/1200', 'pm_score': 2, 'selected': False, 'text': '<p>Whether it\'s a good idea or not really depends on how much you\'re doing. A full system restore point is weighty - it takes time to create, disk space to store, and gets added to the interface of restore points, possibly pushing earlier restore points out of storage.</p>\n\n<p>So, if your update is really only changing <em>your</em> application (i.e. the data it stores, the binaries that make it up, the registry entries for it), then it\'s not really a system level change, and I\'d vote for no restore point. You can emulate the functionality by just backing up the parts you\'re changing, and offering a restore to backup option. My opinion is that System Restore should be to restore the system when global changes are made that might corrupt it (application install, etc).</p>\n\n<p>The counter argument that one should just use the system service doesn\'t hold water for me; I worry that, if you have to issue a number of updates to your application, the set of system restore points might get so large that important, real "system wide" updates might get pushed out, or lost in the noise.</p>\n'}, {'answer_id': 32995, 'author': 'DrPizza', 'author_id': 2131, 'author_profile': 'https://Stackoverflow.com/users/2131', 'pm_score': 3, 'selected': True, 'text': '<blockquote>\n  <p>Is it "taboo" to programatically create system restore points?</p>\n</blockquote>\n\n<p>No.  That\'s why the API is there; so that you can have pseudo-atomic updates of the system.</p>\n'}]
['https://Stackoverflow.com/questions/32845', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1490/']