We are trying to set the DirBrowseFlags of a IIsWebDirectory through aspx
page (Server side code) using WMI.

So far we tried this VB code but with no success:

Dim providerObj As Object = GetObject("winmgmts:// " & strWebServerName &
"/root/MicrosoftIISv2")
Dim vdirObj As Object = providerObj.get("IIsWebDirectorySetting='W3SVC/1/" &
strVirtualDirectoryName & "/" & strTemporaryDirectoryName & "'")
vdirObj.DirBrowseFlags = lngFlags
vdirObj.Put_()

At the moment we receive a "The system cannot find the path specified."
error on the following instruction:

Dim vdirObj As Object = providerObj.get("IIsWebDirectorySetting='W3SVC/1/" &
strVirtualDirectoryName & "/" & strTemporaryDirectoryName & "'")

The following code instead works perfectly:

Dim vdirObj As Object =
providerObj.get("IIsWebVirtualDirSetting='W3SVC/1/ROOT/" &
strVirtualDirectoryName & "'")

Why aren't we able to reference the settings of the IIsWebDirectory under a
virtual directory?

MSDN Library says that it is possible to configure the DirBrowseFlags
property at the following locations in the IIS metabase for IIsWebDirectory,
but it seems not to work:

/LM/W3SVC/n/ROOT/physical_directory_name
/LM/W3SVC/n/virtual_directory_name/physical_directory_name

Thank you!