0

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


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.

Tim Post
  • 33,371
  • 15
  • 110
  • 174
Abdu
  • 16,129
  • 13
  • 59
  • 84

2 Answers2

2

You'll need to use ADSI objects. The IIsComputer.Backup method is what you want.

As far as how to access ADSI objects from C#, check out this MSDN page.

EDIT: Here's a sample implementation in C#.

Craig
  • 4,323
  • 2
  • 29
  • 32
0

I found it:

DirectoryEntry de = new DirectoryEntry("IIS://localhost"); de.Invoke("Backup", new object[0] );

new object needs to be set to hold proper arguments like overwriting current backup

Abdu
  • 16,129
  • 13
  • 59
  • 84