$iispath function
$iispath(key)
The $iispath function retrieves a path from the IIS (Internet Information Server, Microsoft's Internet server) metadata database, or an empty path if IIS is not running or does not support the requested data. It is typically used to obtain the physical path to a virtual folder of one of the IIS services, for example the WWW or FTP server's root folder.
Tip: To retrieve general IIS metadata (not limited to paths), use the $iisdata function instead.
Note: Because IIS only runs on Windows NT-based systems (Windows NT4, 2000, XP, and later), the function always returns an empty path 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.
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.
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/ROOT | Physical path to the virtual root folder of the web site identified by n. |
/LM/W3SVC/n/ROOT/virtual_dir | Physical path to the virtual folder virtual_dir on the web site identified by n. |
/LM/MSFTPSVC/n/ROOT | Physical path to the virtual root folder of the FTP site identified by n. |
/LM/MSFTPSVC/n/ROOT/virtual_dir | Physical path to the virtual folder virtual_dir on the FTP site identified by n. |
Examples
Here are some usage examples for this function:
- <$iispath(/LM/W3SVC/1/ROOT)>
- 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. Note: The WWWRootFolder variable retrieves this path, with a reasonable fallback if IIS is not running.
- <$iispath(/LM/W3SVC/1/ROOT/products/tin)>
- Returns the physical path to the virtual folder that is visible as /products/tin on the first web server running under IIS, or an empty path if IIS is not running or is not configured as a web server.