我正在尝试使用站点名称 usingappcmd或其他实用程序查找 IIS7 站点 ID,但没有找到任何方法来实现它。
			
			25474 次
		
5 回答
            27        
        
		
以下命令返回站点 ID:
%systemroot%\system32\inetsrv\APPCMD list site <SiteName>
示例输出:
SITE "Default Web Site" (id:1,bindings:http/*:80:default.local,state:Started)
SITE "My Site" (id:2,bindings:http/*:80:my.local,state:Started)
    于 2012-09-06T08:56:48.730   回答
    
    
            15        
        
		
最简单的方法是加载 IIS 管理器并单击“站点”文件夹。在“功能视图”窗格中显示的列表中应该有一个名为“ID”的列,这就是您的站点 ID。
于 2016-10-06T13:10:45.510   回答
    
    
            5        
        
		
你也可以试试 Powershell get-websitecommandlet。如果没有 args,它将列出所有站点以及 ID。
于 2015-03-31T14:50:47.713   回答
    
    
            2        
        
		
这是执行此操作的 Powershell 方式:
Get-Website -Name "Default Web Site" | Select -ExpandProperty ID
(用您的站点名称替换默认网站。)
于 2019-02-21T10:42:23.367   回答
    
    
            1        
        
		
保存这个 XXX.VBS
dim lookfor: lookfor = lcase(WScript.Arguments(0))
dim ws: set ws = getobject("IIS://localhost/w3svc")
for each site in ws
    if site.class = "IIsWebServer" then
        if lcase(site.ServerComment) = lookfor then
            wscript.echo "id=" & site.Name & ", name=" & site.ServerComment
        end if
    end if
next
然后从命令行
XXX.vbs site.tofind.com
或者
cscript XXX.vbs site.tofind.com
    于 2012-09-05T10:31:37.850   回答