Well for anyone that might come across the same issue I am working around it currently in this manner. My example will only work if you have vCO installed on a windows host and you set the vmo.properties file with com.vmware.js.allow-local-process=true. I first attempt to run it with the plugin and if that fails I fall back to the windows command line utility. If you have the vCO services set to run under a priveledged account I don't think you'll need the user and pwd vars but I haven't tested it.
System.log("Attempting to remove AD object distinguishedName: " + computerAD.distinguishedName);
var tryDsrm = false;
var returnVal = true;
try {
computerAD.destroy();
}
catch (err) {
System.log("AD Computer deletion with vCO plugin attempt failed with error: " + err.message);
tryDsrm = true;
returnVal = false;
}
if (tryDsrm) {
var user = "someusername";
var pwd = "somepasswd";
var commandTxt = "c:/windows/system32/dsrm.exe -noprompt \""+ computerAD.distinguishedName + "\" -u " + user + " -p " + pwd;
var cmd = new Command(commandTxt);
cmd.execute(true);
System.log("Command result: " + cmd.result);
System.log("Command output: " + cmd.output);
if (cmd.result == 0 && cmd.output.indexOf("dsrm succeeded") >= 0) {
System.log("AD computer object deletion successful with DSRM.");
returnVal = true;
}
else {
throw "Failed to remove computer object from AD! Both vCO plugin and DSRM attempts were unsuccessful.";
}
}
else {
System.log("AD computer deletion successful with vCO plugin");
}
return returnVal;