IIS 6 及更早版本附带一个名为 ADSUTIL.VBS:
Adsutil.vbs 是 IIS 管理
使用 Microsoft Visual 的实用程序
基础脚本版 (VBScript)
与活动目录服务
接口(ADSI)来操纵
IIS 配置。 这个脚本应该
使用 CScript 运行,即
与 Windows 脚本宿主一起安装。
换句话说,此工具可让您更改 IIS 元数据库< /a> 从命令行以编程方式设置。
我想从 InstallShield 项目调用此工具,以便对 IIS 进行一些配置更改。 我很好奇重新分发脚本是否合法(源代码中没有合法的措辞)或简单地通过以下方式启动命令:
CSCRIPT %SYSTEMDRIVE%\Inetpub\AdminScripts\adsutil.vbs
并希望脚本存在于磁盘上的该位置。
所以我的问题是 - 即使计算机上的某些其他网站(inetpub 根)位于非系统驱动器上,它是否始终存在于上面的路径中? 似乎所有引用 ADSUTIL 工具的 MSDN 和其他 Microsoft 知识库文章都是通过使用上面的 %SYSTEMDRIVE% 路径来实现的。
我看到至少另一种尝试来处理这个问题通过将 cscript.exe 和 adsutil.vbs 与其 InstallShield 项目一起分发。
也许有注册表项或其他方法来获取 Inetpub\AdminScripts 路径的位置?
也许我应该编写一个 C# 应用程序来更改值 或 我自己的 VBScript 并分发用我自己的小应用程序代替?
IIS 6 and older ships with a utility script called ADSUTIL.VBS:
Adsutil.vbs is an IIS administration
utility that uses Microsoft Visual
Basic Scripting Edition (VBScript)
with Active Directory Service
Interfaces (ADSI) to manipulate the
IIS configuration. This script should
be run using CScript, which is
installed with Windows Script Host.
In other words, this tool lets you change IIS metabase settings programmatically, from the command line.
I would like to call this tool from an InstallShield project in order to make some configuration changes to IIS. I am curious if it either legal to re-distribute the script (there is no legal wording inside the source for it) or to simply launch the command via:
CSCRIPT %SYSTEMDRIVE%\Inetpub\AdminScripts\adsutil.vbs
and hope that the script exists on disk in that location.
So my question is - will it always exist in that path above, even if some other websites (inetpub roots) on the machine are located on a non-system drive? It seems all MSDN and other Microsoft KB articles that refer to the ADSUTIL tool do so by using the %SYSTEMDRIVE% path above.
I see that at least one other attempt to deal with this by distributing both cscript.exe and adsutil.vbs with their InstallShield projects.
Perhaps there is a registry key or other method to obtain the location of the Inetpub\AdminScripts path?
Maybe I should just write a C# application that changes the value or my own VBScript and distribute with my own little app instead?
发布评论
评论(2)
我在JShumaker的答案< /a> 来解决问题。 最好的路线似乎是我调用来运行批处理脚本的以下 InstallScript 函数:
批处理脚本调用此: VBScript
如下所示:
这样做可以减轻在安装过程中使用 ADSUTIL.VBS 的需要 -如果您不需要使用它,则它的(相对)路径是无关紧要的。
I worked in JShumaker's answer to solve the problem. The best route seems to be the following InstallScript function that I call to run a batch script:
The batch script calls this:
And the VBScript looks like this:
Doing it this way relieves the need to use ADSUTIL.VBS as part of the installation - the (relative) path to it is irrelevant if you don't need to use it.
我最近遇到了类似的问题,决定重新编写一小部分 vbscript,以便在 msi 安装程序中的自定义操作中使用。 可能需要一些时间才能弄清楚 adsutil.vbs 的核心工作原理,但它写得非常好。 例如,我需要将应用程序池切换到经典模式而不是集成模式,并明确将其设置为在 64 位 Windows 上运行时以 32 位模式运行,以精炼形式,这会导致以下结果:
I ran into a similar issue recently and decided to just rework a small bit of vbscript to use in a custom action in an msi installer. It can take a bit to figure out the core of how adsutil.vbs does things, but it is deently well writen. For example, i needed to switch an application pool to Classic instead of Integrated mode and explicitly set it to run in 32-bit mode when on 64-bit windows, in distilled form this resulted in this: