dsdbutil AD LDS backup fails from code


  • Hi all,

    I'm new to C# and I'm trying to create a program (WPF - XAML) to backup an AD LDS instance. I use "new Process()" to call dsdbutil.

    When I use this command from my program, it works fine and I can see the output:

    dsdbutil list instances quit

    But when I try to create a snapshot (backup) with the following command from the program, it fails:

    dsdbutil "Activate Instance TestInstance" ifm "Create Full C:\adldsbackup\TestInstance" quit quit

    The output in this case is the following:

    dsdbutil: Activate Instance TestInstance
    Active instance set to "TestInstance".
    dsdbutil: ifm
    ifm: Create Full C:\adldsbackup\TestInstance
     error 0x80042302(A Volume Shadow Copy Service component encountered an unexpected error.
    Check the Application event log for more information.)
    ifm: quit
    dsdbutil: quit

    In the event viewer, there is an error message:

    Event ID: 8193

    Volume Shadow Copy Service error: Unexpected error calling routine CoCreateInstance.  hr = 0x80040154, Class not registered

    When I use the same command in command prompt it works fine. 

    I run my program as an administrator, and all the required services are running.

    The code which starts the process looks like this:

    private void sendCommand(string context, string args, bool listing=false)
                Process process = new Process();
                process.StartInfo.FileName = context;
                process.StartInfo.Arguments = args;
                process.StartInfo.UseShellExecute = false;
                process.StartInfo.RedirectStandardOutput = true;
                process.StartInfo.CreateNoWindow = true;
                process.OutputDataReceived += new DataReceivedEventHandler((dataSender, receivedEvent) =>
                    if (!String.IsNullOrEmpty(receivedEvent.Data))
                        output.Append("\n" + receivedEvent.Data);
                    tbxOutput.Text = "";
                    if (listing == true)
                        using (StringReader sr = new StringReader(output.ToString()))
                            string line;
                            string temp;
                            while ((line = sr.ReadLine()) != null)
                                if (line.Contains("Instance Name:") == true)
                                    temp = line.Replace("Instance Name:", "");
                        tbxOutput.Text += output;
                catch (Exception thrownException)
                    tbxOutput.Text = thrownException.ToString();

    And this is how I call the sendCommand method:

    private void btnBackupADLDS_Click(object sender, RoutedEventArgs e)
                string instanceName = cmbADLDSInstances.Text;
                string backupRoot = "C:\\adldsbackup";
                sendCommand("dsdbutil", "\"Activate Instance " + instanceName + "\" ifm \"Create Full " + backupRoot + "\\" + instanceName + "\" quit quit");
    So first I read all the instances to a ComboBox and then I use it to select the instance name to back it up.

    I think that maybe I'm violating the VSS provider or something like that.

    Could you please help me with this?

    Thank you & Kind regards,


    • Edited by Dvijne Saturday, April 29, 2017 7:57 AM
    Saturday, April 29, 2017 7:53 AM