尝试列出Web服务,Web站点和应用程序池 – Windows Server 2003

我很好奇我将如何列出Web服务,网站和应用程序池到Windows Server 2003计算机上的.txt文件。 我有Powershell 2.0configuration,并试图运行一些脚本,但似乎没有任何工作。

我试过了:

iisweb /query 

我得到一个错误说:

  - This script does not work with WScript - Would you like to register CScript as your default host for VBscript? - To run this script type: `"CScript.exe IIsCnfg.vbs[params]"` 

我尝试使用CScript.exe IIsCnfg.vbs [params]“, but even that command fails and errors out to aninput错误:找不到脚本文件”C:\%SYSTEMROOT%\ system32 \ iiscnfg.vbs“

任何人有任何Windows Server 2003的经验和使用Powershell? Powershell的版本是2.0


@pk

这是它给我的错误代码。 我也不明白它想要我给它的参数。

PS U:> CSript.exe IIsCnfg.vsb / query

 The term 'CSript.exe' is not recognized as the name of a cmdlet, function, script file, oroperable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:11 + CSript.exe <<<< IIsCnfg.vsb /query + CategoryInfo : ObjectNotFound: (CSript.exe:String) [], CommandN otFoundException + FullyQualifiedErrorId : CommandNotFoundException 

使用PowerShell 2.0,您可以通过WMI访问所有configuration对象:

 $appPools = Get-WmiObject -Namespace "root\MicrosoftIISv2" -Class IIsApplicationPool $webSites = Get-WmiObject -Namespace "root\MicrosoftIISv2" -Class IIsWebServerSetting $vDirs = Get-WmiObject -Namespace "root\MicrosoftIISv2" -Class IIsWebVirtualDir 

“名称”属性始终是对象的完整path,即。 W3SVC/2的ID为2的网站。

Windows Server 2003 SP1中IIS提供的WMI类的完整列表