I've been fiddling a bit with c# webservices and vbscript. Things work fine if I trigger the services manually through IE directly on the webserver, but when I try to run the same service from a vbscript it throws a "An operations error occurred." exception.
The service is pretty simple, all it does is create a computer object in Active Directory.
DirectoryEntry Container = new DirectoryEntry("LDAP://ldapgw/" + LDAPLocation);
DirectoryEntries ComputerOU = Container.Children;
DirectoryEntry ComputerObject = ComputerOU.Add("CN=" + ComputerName, "computer");
ComputerObject.InvokeSet("sAMAccountName", ComputerName);
ComputerObject.InvokeSet("description", "Reserved");
ComputerObject.InvokeSet("userAccountControl", 4128);
ComputerObject.CommitChanges();
It's triggered this way:
Set soap = CreateObject("Msxml2.XMLHTTP")
soap "POST", URL, false, username, password
soap.setRequestHeader "Content-Type", "text/xml; charset=utf-8"
soap.setRequestHeader "SOAPAction", nsURL + service
soap.send xml
I'm guessing this has something to do with permissions, but I can't figure out what. I'm using impersonation and if I output WindowsIdentity.GetCurrent()
it seems to be running as the correct user which has the needed rights in AD.
Does anyone know what I'm doing wrong?