Error 0x80005000 using windows prompt to create a user in Active Directory


So I have the following code:

System.Diagnostics.Process process = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Maximized;
startInfo.FileName = "CMD.exe";
string[] serverNameParts = ServerName.Split('.');
string CN1 = t1.Text, CN2 = "Users";
string pwd = t2.Text;
startInfo.Arguments = "/c dsadd user " + "CN=" + CN1 + ",CN=" + CN2 +",";

for (int i = 0; i < serverNameParts.Length; i++)
    startInfo.Arguments = startInfo.Arguments + "DC=" + serverNameParts[i] + ",";
startInfo.Arguments = startInfo.Arguments + " & ping /t";
process.StartInfo = startInfo;

I used ping so I could see why it won't create an account. What I get is this error: Error code = 0x80005000 type dsadd /? for help.

I can't figure out what could be the problem here, I checked the final string and it looks totally fine and I even typed it into the promt and everything worked perfectly, but it won't when I use it in my app. Is there any way to solve this? I suppose it has something to do with the permissions, but I can't come up with an idea to give my program the rights to run an administrator cmd.

asked on Stack Overflow May 27, 2015 by Никита Львов • edited May 27, 2015 by Никита Львов

0 Answers

Nobody has answered this question yet.

User contributions licensed under CC BY-SA 3.0