VirtualDirectoryElementDefaults Class [IIS 7 and higher]
Exposes default configuration settings for IIS virtual directories.
The following table lists the properties exposed by the VirtualDirectoryElementDefaults class.
A read/write boolean value. true if by default IIS looks for Web.config files in content directories lower than the current level; false if IIS does not look for these files in directories lower than the current level.
A read/write sint32 enumeration that specifies the default method by which a user is locally logged on. The type of logon will determine whether the resulting token can also be used remotely. The possible values are listed later in the Remarks section.
A read/write string value that specifies the default encrypted password for access to the virtual root directory. The default is null.
A read/write string value that contains the default virtual directory path.
A read/write string value that specifies the default physical path that is associated with the virtual directory.
A read/write string value that specifies a default user who has rights to access any configuration files or content in a virtual directory. The default is null.
The following table contains the possible values and keywords for the LogonMethod property. The default is 3 (ClearText). For more information, see the LogonUserEx function.
Enables the user to log on interactively through a terminal server, remote shell, or similar process. Because this logon type caches logon information for disconnected operations, performance may be affected. This logon type is, therefore, inappropriate for client/server applications, such as mail servers.
Enables the user to log on through a batch server, where processes can be executed for the user without the user's intervention. This logon type is appropriate for servers, such as mail or Web servers, that process many plaintext authentication attempts at a time. Credentials are not cached for this logon type.
Enables the user to log on through a high-performance server that authenticates plaintext passwords. Credentials are not cached for this logon type.
Enables the user to log on by using Basic authentication. The user's name and password are preserved in an authentication package, which allows the server to make connections to other network servers while impersonating the client.
An authentication package is a DLL that encapsulates the authentication logic that determines whether to permit a user to log on. Local Security Authority (LSA) authenticates a user logon by sending the request to an authentication package. The authentication package then examines the logon information and either authenticates or rejects the user logon attempt.
The following example shows how to set the user name and password for all virtual directories on a Web site. It then shows how to retrieve all the virtual directory defaults for the site.
' Connect to the WMI WebAdministration namespace. Set oWebAdmin = GetObject("winmgmts:root\WebAdministration") ' Get the default Web site. Set oSite = oWebAdmin.Get("Site.Name='Default Web Site'") ' Set the virtual directory defaults on the Web site. oSite.VirtualDirectoryDefaults.UserName = "JohnV" oSite.VirtualDirectoryDefaults.Password = "p@ssw0rd." oSite.Put_ ' List all the virtual directory defaults for the Web site. WScript.Echo "AllowSubDirConfig: " & _ oSite.VirtualDirectoryDefaults.AllowSubDirConfig WScript.Echo "LogonMethod: " & _ GetLogonMethodText(oSite.VirtualDirectoryDefaults.LogonMethod) WScript.Echo "Password: " & oSite.VirtualDirectoryDefaults.Password WScript.Echo "Path: " & oSite.VirtualDirectoryDefaults.Path WScript.Echo "PhysicalPath: " & _ oSite.VirtualDirectoryDefaults.PhysicalPath WScript.Echo "UserName: " & oSite.VirtualDirectoryDefaults.UserName ' This helper function converts the LogonMethod value to text. Function GetLogonMethodText(LogonMethodValue) Select Case LogonMethodValue Case 0 GetLogonMethodText = "Interactive" Case 1 GetLogonMethodText = "Batch" Case 2 GetLogonMethodText = "Network" Case 3 GetLogonMethodText = "ClearText" Case Else GetLogonMethodText = "Unknown logon method." End Select End Function