列出所有虚拟目录在IIS 5,6和7 [英] List all virtual directories in IIS 5,6 and 7

查看:128
本文介绍了列出所有虚拟目录在IIS 5,6和7的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想一个IIS网站中创建的所有虚拟目录的列表。然而,我发现,试图做到这一点在老版本的IIS参差。在IIS 7中,这是通过C#一个相对轻松的工作,但我似乎无法找到一个很好的方法在IIS 6和5。

I am trying to create a list of all virtual directories within an IIS site. However, I have found that trying to do this varies dramatically in the older versions of IIS. In IIS 7 this is a relatively easy task via C# but I can't seem to find a good method for doing this in IIS 6 and 5.

我已经尝试使用这样在System.DirectoryServices.DirectoryEntry但这似乎并没有给我所需的输出。

I have tried using the System.DirectoryServices.DirectoryEntry but that doesn't seem to give me the desired output.

我是服务器管理员,所以我开到使用其他的东西,如。.VBS内置到IIS以及编写自己的代码文件

I am the server administrator so I'm open to using other things such as .vbs files that are built into IIS as well as writing my own code.

推荐答案

你尝试使用GetObject的(IIS: //服务器/ W3SVC)

have you tried using GetObject("IIS://ServerName/W3SVC")

您做它在VBS这样

'Get the IIS Server Object
Set oW3SVC = GetObject("IIS://ServerName/W3SVC/1/ROOT")

For Each oVirtualDirectory In oW3SVC

    Set oFile = CreateObject("Scripting.FileSystemObject")
    Set oTextFile = oFile.OpenTextFile("C:\Results.txt", 8, True)

    oTextFile.WriteLine(oVirtualDirectory.class + " -" + oVirtualDirectory.Name)
    oTextFile.Close

Next
Set oTextFile = Nothing
Set oFile = Nothing

Wscript.Echo "Done"

我有一个关于它的文章在这里 - >的 http://anyrest.wordpress.com/2010 / 02/10 /如何对列表的所有网站,在IIS /

I have an article about it here -> http://anyrest.wordpress.com/2010/02/10/how-to-list-all-websites-in-iis/

这篇关于列出所有虚拟目录在IIS 5,6和7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆