ApplicationContainsVirtualDirectory Class [IIS 7 and higher]

Provides a relationship between an IIS application and its virtual directories.

Syntax

class ApplicationContainsVirtualDirectory : ObjectContainerAssociation

Methods

This class contains no methods.

Properties

The following table lists the properties exposed by the ApplicationContainsVirtualDirectory class.

Name

Description

Container

(Inherited from ObjectContainerAssociation.) A read-only Application object that represents an IIS application. A key property.

Element

(Inherited from ObjectContainerAssociation.) A read-only VirtualDirectory object that represents an IIS virtual directory. A key property.

Subclasses

This class contains no subclasses.

Remarks

This association enumerates the virtual directories for a given application.

Example

The following example lists the virtual directory paths and physical paths for the default Web site.

' Connect to the WMI WebAdministration namespace.
Set oWebAdmin = GetObject("winmgmts:root\WebAdministration")

' Get the application for the default Web site.
Set oApp = oWebAdmin.Get("Application.SiteName='Default Web Site',Path='/'")

' Return the set of virtual directory instances in the application.
Set oVDirs = oApp.Associators_("ApplicationContainsVirtualDirectory")

' Print out the virtual directories and their physical paths.
For Each oVDir In oVDirs
    WScript.Echo "Virtual Path: " & oVDir.Path
    WScript.Echo "PhysicalPath: " & oVDir.PhysicalPath
    WScript.Echo
Next

Note the following syntax from the preceding code example.

Set oVDirs = oApp.Associators_("ApplicationContainsVirtualDirectory")

To simplify your code, you can instead use the following syntax, which enables you to use the association without having to remember its exact name.

Set oVDirs = oApp.Associators_(, "VirtualDirectory")

Inheritance Hierarchy

ObjectContainerAssociation

   ApplicationContainsVirtualDirectory

Requirements

Type

Description

Client

Requires IIS 7 on Windows Vista.

Server

Requires IIS 7 on Windows Server 2008.

Product

IIS 7

MOF file

WebAdministration.mof

See Also

Reference

Application Class [IIS 7 and higher]

ObjectContainerAssociation Class [IIS 7 and higher]

VirtualDirectory Class [IIS 7 and higher]