IIS 関連の Windows Feature をAdd-WindowsFeature でインポートするときに、纏めてやるならということで。
DSC で別手段が提供されるわけですが、これも大事です。
※ Windows Server 2012 で私は動作確認しています。 8では動きませんので悪しからず。
コード
さくっと。
Import-Module ServerManager
@("Web-Server",
"Web-Http-Errors",
"Web-App-Dev",
"Web-Asp-Net",
"Web-Net-Ext",
"Web-ASP",
"Web-CGI",
"Web-ISAPI-Ext",
"Web-ISAPI-Filter",
"Web-Includes",
"Web-Basic-Auth",
"Web-Windows-Auth",
"Web-Mgmt-Compat",
"Web-Metabase",
"Web-WMI",
"Web-Lgcy-Scripting",
"Web-Lgcy-Mgmt-Console"
)| Add-WindowsFeature
実行するとこのようにでます。
Success Restart Needed Exit Code Feature Result
------- -------------- --------- --------------
True No NoChangeNeeded {}
確認
確認しましょう。
Get-WindowsFeature
結果インストールされていますね。
[X] Web Server (IIS) Web-Server Installed
[X] Web Server Web-WebServer Installed
[X] Common HTTP Features Web-Common-Http Installed
[X] Default Document Web-Default-Doc Installed
[X] Directory Browsing Web-Dir-Browsing Installed
[X] HTTP Errors Web-Http-Errors Installed
[X] Static Content Web-Static-Content Installed
[X] HTTP Redirection Web-Http-Redirect Installed
[X] WebDAV Publishing Web-DAV-Publishing Installed
[X] Health and Diagnostics Web-Health Installed
[X] HTTP Logging Web-Http-Logging Installed
[X] Custom Logging Web-Custom-Logging Installed
[X] Logging Tools Web-Log-Libraries Installed
[X] ODBC Logging Web-ODBC-Logging Installed
[X] Request Monitor Web-Request-Monitor Installed
[X] Tracing Web-Http-Tracing Installed
[X] Performance Web-Performance Installed
[X] Static Content Compression Web-Stat-Compression Installed
[X] Dynamic Content Compression Web-Dyn-Compression Installed
[X] Security Web-Security Installed
[X] Request Filtering Web-Filtering Installed
[X] Basic Authentication Web-Basic-Auth Installed
[X] Centralized SSL Certificate Support Web-CertProvider Installed
[X] Client Certificate Mapping Authentic... Web-Client-Auth Installed
[X] Digest Authentication Web-Digest-Auth Installed
[X] IIS Client Certificate Mapping Authe... Web-Cert-Auth Installed
[X] IP and Domain Restrictions Web-IP-Security Installed
[X] URL Authorization Web-Url-Auth Installed
[X] Windows Authentication Web-Windows-Auth Installed
[X] Application Development Web-App-Dev Installed
[X] .NET Extensibility 3.5 Web-Net-Ext Installed
[X] .NET Extensibility 4.5 Web-Net-Ext45 Installed
[X] Application Initialization Web-AppInit Installed
[X] ASP Web-ASP Installed
[X] ASP.NET 3.5 Web-Asp-Net Installed
[X] ASP.NET 4.5 Web-Asp-Net45 Installed
[X] CGI Web-CGI Installed
[X] ISAPI Extensions Web-ISAPI-Ext Installed
[X] ISAPI Filters Web-ISAPI-Filter Installed
[X] Server Side Includes Web-Includes Installed
[X] WebSocket Protocol Web-WebSockets Installed
[X] FTP Server Web-Ftp-Server Installed
[X] FTP Service Web-Ftp-Service Installed
[X] FTP Extensibility Web-Ftp-Ext Installed
[X] IIS Hostable Web Core Web-WHC Installed
[X] Management Tools Web-Mgmt-Tools Installed
[X] IIS Management Console Web-Mgmt-Console Installed
[X] IIS 6 Management Compatibility Web-Mgmt-Compat Installed
[X] IIS 6 Metabase Compatibility Web-Metabase Installed
[X] IIS 6 Management Console Web-Lgcy-Mgmt-Console Installed
[X] IIS 6 Scripting Tools Web-Lgcy-Scripting Installed
[X] IIS 6 WMI Compatibility Web-WMI Installed
[X] IIS Management Scripts and Tools Web-Scripting-Tools Installed
[X] Management Service Web-Mgmt-Service Installed
GitHuv
参考程度に。
https://github.com/guitarrapc/PowerShellUtil/blob/master/Add-IISFeature/Add-IISFeature.ps1