How to get IIS site object via ADSI ?
public function get_IIS_Website(webSvrID)
on error resume next
set get_IIS_Entry = GetObject("IIS://Localhost/W3SVC/" & webSvrID)
if (Err.Number <> 0) then
on error goto 0
Err.Raise 10000, "get_IIS_Entry", "failed"
Else
if (get_IIS_Entry.Class <> "get_IIS_Website") Then
on error goto 0
Err.Raise 1000, "get_IIS_WebSite", "incorrect"
end if
end if
on error goto 0
end function
How to get IIS site object via WMI ?
How to get IIS site object via APPCMD?
How to get IIS site object via Shell?
What is IIS metabase?
In IIS, the metabase stores information about the configuration of IIS. A developer can create Web sites, virtual directories, change performance and security settings, install ISAPI DLLs, and make choices about what information is written to the IIS log files, and all of that information is stored in the metabase.
quote from msdn.microsoft.com
According to above information, Microsoft's Internet Information Services stores its information in an internal database called the MetaBase. Developer are able to use ADSI provider or WMI provider to handle metabase data and finally programmatic changes get written to the in-memory metabase.
We need pay attention to metabase format , different versions of IIS use different formats; prior to IIS version 6 database was always a proprietary format, whereas with 6.0 and later the data is stored in XML files. The metabase consists of two files, MetaBase.xml and MBSchema.xml, stored in the %SystemRoot%\system32\inetsrv\ directory. The metabase periodically gets backed up to the MetaBack subdirectory.
Internet Information Services' central metabase is eliminated in IIS version 7 in favor of a set of XML configuration files that are located centrally in the Machine.config and ApplicationHost.config files and within the web site's infrastructure using web.config files. This allows for synchronization of web sites across servers by including all configuration information within the web site's root directory.
What is ADSI Provider?
The ADSI provider, like the WMI provider, provides a standard syntax for accessing IIS configuration data through the use of the IIS admin objects. The admin objects in the IIS ADSI provider inherit useful methods and properties from Windows ADSI objects and container objects that help configure data in the metabase.
quote from msdn.microsoft.com
Due to ADSI rely on metabase structure , however, the metabase is deprecated in IIS7 and above version. We need install 6.0 compatibility role for Internet Information Services first in order to use ADSI provider.