ApplicationContainsVirtualDirectory Class2

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 - IIS 7.0 on Windows Vista
- IIS 7.5 on Windows 7
- IIS 8.0 on Windows 8
- IIS 10.0 on Windows 10
Server - IIS 7.0 on Windows Server 2008
- IIS 7.5 on Windows Server 2008 R2
- IIS 8.0 on Windows Server 2012
- IIS 8.5 on Windows Server 2012 R2
- IIS 10.0 on Windows Server 2016
Product - IIS 7.0, IIS 7.5, IIS 8.0, IIS 8.5, IIS 10.0
MOF file WebAdministration.mof

See Also

Application Class
ObjectContainerAssociation Class
VirtualDirectory Class