IIS API - 创建虚拟目录? [英] IIS API - Create virtual directories?

查看:43
本文介绍了IIS API - 创建虚拟目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

只是在寻找相关文档.示例不是必需的,但将不胜感激.

Just looking for the relevant documentation. An example is not necessary, but would be appreciated.

我们有一种情况,我们必须手动创建 100 个虚拟目录,现在看来,自动化这将是提高流程效率的好方法.

We have a situation where we are having to create 100s of virtual directories manually, and it seems like automating this would be a good way to make the process more efficient for now.

也许明年我们可以重新设计服务器环境以允许更明智的事情,例如 URL 重写(不幸的是,这在当前的 Web 应用程序周期中似乎不可行).继承垃圾代码不是很好吗?

Perhaps next year we can rework the server environment to allow something more sane, such as URL rewriting (unfortunately this does not seem feasible in the current cycle of the web application). Isn't it great to inherit crap code?

~威廉·莱利-兰德

推荐答案

显然你也可以通过 PowerShell 脚本来做到这一点:

Evidently you can also do this via PowerShell scripting:

$objIIS = new-object System.DirectoryServices.DirectoryEntry("IIS://localhost/W3SVC/1/Root")
$children = $objIIS.psbase.children
$vDir = $children.add("NewFolder",$objIIS.psbase.SchemaClassName)
$vDir.psbase.CommitChanges()
$vDir.Path = "C:\Documents and Settings\blah\Desktop\new"
$vDir.defaultdoc = "Default.htm"
$vDir.psbase.CommitChanges()

这里是文档:MSDN - 使用 IIS 编程管理

这篇关于IIS API - 创建虚拟目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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