IIS 7 and Above
GetObject("IIS://LocalHost/W3SVC/1/ROOT") fails on IIS 7
Last post Sep 05, 2006 01:49 PM by dhacker
Aug 30, 2006 05:43 PM|JeromeC|LINK
In IIS 6 I could create virtual directories using the following:
On Error Resume Next
Set iRoot = GetObject("IIS://LocalHost/W3SVC/1/ROOT")
if (Err.Number <> 0) then
MsgBox "Web Server doesn't exist"
Set MyVirDir = iRoot.Create("IIsWebVirtualDir", "VirDir")
The call to GetObject("IIS://LocalHost/W3SVC/1/ROOT") fails on IIS 7
Can you please shed some light on this failure?
Aug 31, 2006 08:40 PM|rayner|LINK
What error do you get when you say it fails on IIS7? You may also need to install the IIS-Metabase package to use the ADSI and the ABO(Metabase) Compat layers.
Sep 01, 2006 12:45 PM|JeromeC|LINK
I apologize for being vague - My call to GetObject("IIS://LocalHost/W3SVC/1/ROOT") returns a non-zero value. I suspect that the path has changed in IIS 7 – is IIS://LocalHost/W3SVC/1/ROOT valid
in IIS 7. If no, can you provide the correct value?
Thank you for your support!
Sep 01, 2006 01:08 PM|rayner|LINK
set xyz = GetObject("IIS://localhost/w3svc/1/root") is still valid in IIS7. It may not work if either the scripting (ADSI) or AdminBaseObject support modules are not installed on the machine. The non-zero value returned may help me diagnose what may be amiss.
Sep 05, 2006 12:03 PM|JeromeC|LINK
I was able to resolve the behavior using your suggestion of enabling the IIS Metabase and IIS6 configuration compatibility option located in the OptionalFeature view of Vista.
(For the record the return code of the call was -2147221020)
Thank you again for your assistance in this matter.
Sep 05, 2006 01:49 PM|dhacker|LINK
If configuring IIS 7 using legacy scripts, you might be interested in this article:
It explains that the 'Metabase Compatibility component of IIS 7.0' must be installed and is not installed by default.