$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.
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.
Windows Installer does not support symbolic functions; if you use this function
during an MSI build, you will get diagnostic message BLD:U0010
and the result is undefined.
All parameters may contain symbolic references; these are resolved before the function is applied. See Examples below.
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. |
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. |
Here are some usage examples for this function: