<p>exact code will be helpful. I assume the DirectoryServices namespace does it but I can't find the method that does it.</p>

<hr>

<p>I need actual C# code. All the samples I found so far are VB or VBScript. The C# examples I found are for reading/setting ADSI properties. A command like backup seems to have a certain .NET syntax which I am not clear how to use. In VB there's a straightforward backup command. Need an equivalent in .NET.</p>

[{'answer_id': 50161, 'author': 'Craig', 'author_id': 2047, 'author_profile': 'https://Stackoverflow.com/users/2047', 'pm_score': 2, 'selected': False, 'text': '<p>You\'ll need to use ADSI objects. The <a href="http://msdn.microsoft.com/en-us/library/ms525753.aspx" rel="nofollow noreferrer">IIsComputer.Backup</a> method is what you want.</p>\n\n<p>As far as how to access ADSI objects from C#, check out this <a href="http://support.microsoft.com/kb/315716" rel="nofollow noreferrer">MSDN page</a>.</p>\n\n<p><strong>EDIT:</strong> Here\'s a <a href="http://www.vbforums.com/archive/index.php/t-470587.html" rel="nofollow noreferrer">sample implementation in C#</a>.</p>\n'}, {'answer_id': 51365, 'author': 'Abdu', 'author_id': 5232, 'author_profile': 'https://Stackoverflow.com/users/5232', 'pm_score': 1, 'selected': True, 'text': '<p>I found it:</p>\n\n<p>DirectoryEntry de = new DirectoryEntry("IIS://localhost");\n de.Invoke("Backup", new object[0] );</p>\n\n<p>new object needs to be set to hold proper arguments like overwriting current backup</p>\n'}]
['https://Stackoverflow.com/questions/50089', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5232/']