$iisdata function

$iisdata(key,attribute)

The $iisdata function retrieves a metadata string from the IIS (Internet Information Server, Microsoft's Internet server) database, or an empty string if IIS is not running or does not support the requested data. If the original metadata information is not a String type, it is converted automatically to a string if possible.

Tip: To retrieve IIS folder paths, use the $iispath function instead.

Note: Because IIS only runs on Windows NT-based systems (Windows NT4, 2000, XP, and later), the function always returns an empty string on other platforms.

Warning Many of the metadata information requires elevated privileges (usually Administrator rights). Therefore, this function may fail if the installer is running with a less privileged account. Typically only /LM/W3SVC (and below) information is available to non-Administrator users.

Parameters

All parameters may contain symbolic references; these are resolved before the function is applied. See Examples below.

key
Metadata key path to look up. See Microsoft's IMSAdminBase::GetData documentation and the table below for commonly used paths.
attribute
Metadata attribute identifier. This is a number that identifies the data that you want to retrieve from the metadata key. See Common IIS attribute IDs below for details.

Common IIS path names

The key parameter must specify the metadata path of the information that you want to retrieve. Here are some commonly used keys (refer to Microsoft's IMSAdminBase::GetData documentation for a full list):

Key path Result
/LM/W3SVC/n Information for web server n.
/LM/W3SVC/n/ROOT Information about the virtual root folder of web server n.
/LM/MSFTPSVC/n Information for FTP server n.
/LM/MSFTPSVC/n/ROOT Information about the virtual root folder of FTP server n.
/LM/SMTPSVC/n Information for SMTP server n.

Common IIS attribute IDs

The attribute parameter must be the numeric identifier of the metadata attribute that you want to retrieve from the given key. The available numeric identifiers are listed in the file iiscnfg.h that is part of the Platform SDK, plus in other Microsoft IIS documentation. Below are some commonly used attribute identifiers. You can also use the IIS Metabase Editor to inspect the IIS database and obtain the required attribute IDs.

Value Identifier Data
1015 MD_SERVER_COMMENT Comment, usually a descriptive string about a server.
3001 MD_VR_PATH

File or folder path, usually the physical path to a virtual folder.

Tip: This attribute is equivalent to calling $iispath().

4001 MD_LOGFILE_DIRECTORY Log file folder path.

Examples

Here are some usage examples for this function:

<$iisdata(/LM/W3SVC/1, 1015)>
Returns the server comment for the first web server running under IIS.
<$iisdata(/LM/W3SVC/1/ROOT, 3001)>
Returns the physical path to the virtual root folder of the first web server running under IIS, or an empty path if IIS is not running or is not configured as a web server. This is equivalent to <$iispath(/LM/W3SVC/1/ROOT)>.