VirtualDirectory.RevertToParent Method [IIS 7 and higher]
Reverts a virtual directory's configuration value or values to the default.
Syntax
VirtualDirectory.RevertToParent(PropertyName)
VirtualDirectory.RevertToParent(PropertyName);
Parameters
Name |
Description |
---|---|
PropertyName |
An optional string value that contains the name of a virtual directory property to revert to the default specified by the VirtualDirectoryElementDefaults class that is exposed as the VirtualDirectoryDefaults property on the Application class. |
Return Value
This method does not return a value.
Remarks
When you call the RevertToParent method without parameters, all custom configuration values for the virtual directory will be removed. If this is not the behavior you want, revert specific properties by using parameterized calls to the method.
Example
The following example reverts the AllowSubDirConfig property of the MyVDir virtual directory from its current value of false to its default value of true.
' Connect to the WMI WebAdministration namespace.
Set oWebAdmin = GetObject( _
"winmgmts:root\WebAdministration")
' Assign the virtual directory instances to a variable.
Set oVDirs = oWebAdmin.InstancesOf("VirtualDirectory")
' Retrieve the MyVDir virtual directory.
For Each oVDir In oVDirs
If oVDir.Path = "/MyVDir" Then
' Display the virtual directory path.
WScript.Echo "Virtual Path: " & oVDir.Path
' Display the current value.
WScript.Echo "AllowSubDirConfig before revert: " & _
oVDir.AllowSubDirConfig
' Revert the AllowSubDirConfig property.
oVdir.RevertToParent("AllowSubDirConfig")
' Refresh the oVdir object variable.
oVdir.Refresh_
' Display the changed value.
WScript.Echo "AllowSubDirConfig after revert: " & _
oVDir.AllowSubDirConfig
' Exit the loop.
Exit For
End If
Next
' Output:
' Virtual Path: /MyVDir
' AllowSubDirConfig before revert: False
' AllowSubDirConfig after revert: True
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]