以编程方式获取 IIS 网站标识符
我正在尝试在 IIS 6.0 上安装的 Web 应用程序的安装脚本中使用 adsutil 来设置访问控制。有一个命令的工作方式如下:
adsutil.vbs set w3svc/1/root/Authflags 4
这是默认网站的命令,因为其标识符为 1。但是,新的 Web 应用程序会被赋予一个生成的标识符。就我而言,我安装的应用程序的标识符为 2082238887,因此我的命令应如下所示
adsutil.vbs set w3svc/2082238887/root/Authflags 4
但是,我现在只从之前安装的应用程序中知道该值。在全新安装期间如何获取此 ID?我见过的 adsutil 的每个示例都假设您正在使用默认网站,因此 ID 为 1。
我需要安装脚本来安装应用程序,获取其标识符,然后使用它通过 adsutil 设置权限。
I'm trying to use adsutil in an installation script of a web app I am installing on IIS 6.0 to set access control. There is a command that works as follows:
adsutil.vbs set w3svc/1/root/Authflags 4
This is the command for the default web site, as its Identifier is 1. However, new web apps are given a generated Identifier. In my case, the app I installed was given the Identifier of 2082238887, so my command should look like this
adsutil.vbs set w3svc/2082238887/root/Authflags 4
However, I only know this value now from previously installing the app. How would I get this ID during a fresh installation? Every example I have seen for adsutil assumes you are working with the default web site, and therefore an ID of 1.
I need my install script to install the app, get its Identifier, and then use it to set permissions via adsutil.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
该脚本允许您提供站点名称作为参数,并迭代网站,直到它与您提供的站点名称匹配。我包含了更新 authflags 的代码。这可以通过 cscript.exe 运行。
This script lets you provide the site name as a parameter and iterates over the web sites until it matches the site name you provide. I included the code to update the authflags. This can be run via cscript.exe.