I found a test program to set the Path property and it also gets the
exception below:
Unhandled Exception: System.Runtime.InteropServices.COMException
(0x80005006): Exception from HRESULT: 0x80005006.
at System.DirectoryServices.Interop.IAds.GetEx(String bstrName)
at System.DirectoryServices.PropertyValueCollection.PopulateList()
at System.DirectoryServices.PropertyCollection.get_Item(String
propertyName)
at ADWrite.Main(String[] args)
Even running this app ON my XP box but referencing the Win2000 box
gives me the same error. I am running my test program below with the
following options (and yes the site number is 4 on the WIn2000 box):
SetADSI IIS://vkessler/W3SVC/4/Root Path c:\Temp
If I run this on the XP box and change the Root Path there it works
fine.
Here is the code for the test app (compiles with just csc.exe):
--------------------------------------------------------------
using System;
using System.DirectoryServices;
public class ADWrite {
public static void Main(String[] args) {
if ( args.Length!=3 ) {
Console.WriteLine("Usage: " +
Environment.GetCommandLineArgs()[0] + " <ad_path> <property>
<value>");
return;
}
DirectoryEntry objDirEnt = new DirectoryEntry(args[0]);
Console.WriteLine("Name = " + objDirEnt.Name);
Console.WriteLine("Path = " + objDirEnt.Path);
Console.WriteLine("SchemaClassName = " +
objDirEnt.SchemaClassName);
Console.WriteLine(args[1] + " = " +
(objDirEnt.Properties[args[1]][0]).ToString());
Console.WriteLine("... changing to ");
(objDirEnt.Properties[args[1]])[0] = args[2];
objDirEnt.CommitChanges();
Console.WriteLine(args[1] + " = " +
(objDirEnt.Properties[args[1]][0]).ToString());
}
}