Error 0x80005000 when using Directory Services in .NET
I am currently developing a deployment tool to help me do easy deployments of websites to many web servers at the same time.
To do this I am using a combination of WMI and Directory services in .NET.
When I tried out the tool on our production environment I got some COM exceptions.
Naturally I started looking at my code, trying different approaches, but to no avail.
I then later found our that to use the directory services together with IIS, you need to have IIS installed on the machine you are running the code from.
Even if you do not manipulate the local machine.
So e.g. a directory URL called IIS://machinename/W3SVC will not work, unless you install IIS on the local machine from where you run the code.
If IIS is not installed you will get an error like:
The code I was using was: