GetObject("IIS://LocalHost/W3SVC/1/ROOT") fails on IIS 7 RRS feed

  • Question

  • User1970902939 posted


    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"


    end if


    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?

    Wednesday, August 30, 2006 5:43 PM

All replies

  • User2120596880 posted

    Hi Jerome,

    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.

    Thanks, Rayner.

    Thursday, August 31, 2006 8:40 PM
  • User1970902939 posted

    Hello Rayner,

    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!


    Friday, September 1, 2006 12:45 PM
  • User2120596880 posted

    Hi Jerome,

    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.

    Thanks, Rayner

    Friday, September 1, 2006 1:08 PM
  • User1970902939 posted

    Hello Rayner,


    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.

    Best Regards,


    Tuesday, September 5, 2006 12:03 PM
  • User-1202834629 posted

    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.

    Tuesday, September 5, 2006 1:49 PM