powershell - 启用 'IIS Management Scripts and Tools'的Powershell脚本

标签 powershell windows-7 build-automation

环顾四周后(我不得不承认这不是很长时间),我想知道是否有人可以将我指向一个Powershell脚本,该脚本检查“IIS管理脚本和工具”是否已启用,如果没有启用,那么它将像从“添加Windows”中一样启用它。特征。

我检查了poshcode.org和powershell.com,找不到一个

我以前从未接触过Powershell,并且试图使用此脚本作为部署自动化的一部分来运行

干杯

最佳答案

是Windows 2008还是Windows Server 2008 R2?

Server 2008R2:

-查询:

PS> get-windowsfeature|where{$_.name -eq "Web-Scripting-Tools"}

Display Name                                            Name
------------                                            ----
        [X] IIS Management Scripts and Tools            Web-Scripting-Tools

“[X]”表示已安装。

-加上:
PS> get-windowsfeature|where{$_.name -eq "Web-Scripting-Tools"}|add-windowsfeature

如果您询问有关Server 2008的信息,则必须解析servermanagercmd.exe的输出,这会有些困难,但并非没有可能。

关于powershell - 启用 'IIS Management Scripts and Tools'的Powershell脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1608506/

相关文章:

javascript - 在javascript中如何调用powershell脚本

shell - 用于 Windows 7 的 Korn-Shell?

windows-7 - 如何使 FFMPEG 在 CMD 中可访问

java - Ant 无法在它创建的 .jar 文件中找到类

build-process - 寻找强大的构建管理系统

iphone - 为 iphone 应用程序设置自动构建服务器的最佳实践?

powershell - 使用PowerShell更改.csv中的samaccountname

powershell - 使用 Powershell 和测试路径,我如何区分 "folder doesn' t 存在”和 "access denied"

sql-server - 将XML直接从SQL Server输出到文件

windows-7 - 当我的笔记本电脑在 Windows 7 中进入休眠状态时关闭正在运行的应用程序(合上盖子或按下 sleep 按钮)