Сервер ОС,
В Windows Server можно выполнить следующую команду, чтобы автоматизировать установку IIS:
#-LogPath can be added if you want a log to be created of the installation
#-Restart can be added if you want to auto restart after installation
Install-WindowsFeature -ComputerName SomePCHere -Name Web-Server
Вот имена функций IIS с точки PowerShell зрения:
Display Name Name
------------ ----
[ ] Web Application Proxy Web-Application-Proxy
[ ] Web Server (IIS) Web-Server
[ ] Web Server Web-WebServer
[ ] Common HTTP Features Web-Common-Http
[ ] Default Document Web-Default-Doc
[ ] Directory Browsing Web-Dir-Browsing
[ ] HTTP Errors Web-Http-Errors
[ ] Static Content Web-Static-Content
[ ] HTTP Redirection Web-Http-Redirect
[ ] WebDAV Publishing Web-DAV-Publishing
[ ] Health and Diagnostics Web-Health
[ ] HTTP Logging Web-Http-Logging
[ ] Custom Logging Web-Custom-Logging
[ ] Logging Tools Web-Log-Libraries
[ ] ODBC Logging Web-ODBC-Logging
[ ] Request Monitor Web-Request-Monitor
[ ] Tracing Web-Http-Tracing
[ ] Performance Web-Performance
[ ] Static Content Compression Web-Stat-Compression
[ ] Dynamic Content Compression Web-Dyn-Compression
[ ] Security Web-Security
[ ] Request Filtering Web-Filtering
[ ] Basic Authentication Web-Basic-Auth
[ ] Centralized SSL Certificate Support Web-CertProvider
[ ] Client Certificate Mapping Authentic... Web-Client-Auth
[ ] Digest Authentication Web-Digest-Auth
[ ] IIS Client Certificate Mapping Authe... Web-Cert-Auth
[ ] IP and Domain Restrictions Web-IP-Security
[ ] URL Authorization Web-Url-Auth
[ ] Windows Authentication Web-Windows-Auth
[ ] Application Development Web-App-Dev
[ ] .NET Extensibility 3.5 Web-Net-Ext
[ ] .NET Extensibility 4.5 Web-Net-Ext45
[ ] Application Initialization Web-AppInit
[ ] ASP Web-ASP
[ ] ASP.NET 3.5 Web-Asp-Net
[ ] ASP.NET 4.5 Web-Asp-Net45
[ ] CGI Web-CGI
[ ] ISAPI Extensions Web-ISAPI-Ext
[ ] ISAPI Filters Web-ISAPI-Filter
[ ] Server Side Includes Web-Includes
[ ] WebSocket Protocol Web-WebSockets
[ ] FTP Server Web-Ftp-Server
[ ] FTP Service Web-Ftp-Service
[ ] FTP Extensibility Web-Ftp-Ext
[ ] Management Tools Web-Mgmt-Tools
[ ] IIS Management Console Web-Mgmt-Console
[ ] IIS 6 Management Compatibility Web-Mgmt-Compat
[ ] IIS 6 Metabase Compatibility Web-Metabase
[ ] IIS 6 Management Console Web-Lgcy-Mgmt-Console
[ ] IIS 6 Scripting Tools Web-Lgcy-Scripting
[ ] IIS 6 WMI Compatibility Web-WMI
[ ] IIS Management Scripts and Tools Web-Scripting-Tools
[ ] Management Service Web-Mgmt-Service
[ ] IIS Hostable Web Core Web-WHC
Отделите каждую функцию, которую вы хотите установить запятой по параметру «Имя». Пример:
Install-WindowsFeature -ComputerName SomePCHere -Name Web-Server, Web-Mgmt-Tools, Web-Security
Клиенты ОС,
В Windows 8.1+ вы можете использовать Get-WindowsOptionalFeature
и Enable-WindowsOptionalFeature
установить IIS.
Выполнив следующие вы можете получить имена функций IIS с точки PowerShell зрения:
PS C:\> Get-WindowsOptionalFeature -online | Where {$_.FeatureName -like 'IIS*'} | Sort FeatureName | Format-Table
FeatureName State
----------- -----
IIS-ApplicationDevelopment Disabled
IIS-ApplicationInit Disabled
IIS-ASP Disabled
IIS-ASPNET Disabled
IIS-ASPNET45 Disabled
IIS-BasicAuthentication Disabled
IIS-CertProvider Disabled
IIS-CGI Disabled
IIS-ClientCertificateMappingAuthentication Disabled
IIS-CommonHttpFeatures Disabled
IIS-CustomLogging Disabled
IIS-DefaultDocument Disabled
IIS-DigestAuthentication Disabled
IIS-DirectoryBrowsing Disabled
IIS-FTPExtensibility Disabled
IIS-FTPServer Disabled
IIS-FTPSvc Disabled
IIS-HealthAndDiagnostics Disabled
IIS-HostableWebCore Disabled
IIS-HttpCompressionDynamic Disabled
IIS-HttpCompressionStatic Disabled
IIS-HttpErrors Disabled
IIS-HttpLogging Disabled
IIS-HttpRedirect Disabled
IIS-HttpTracing Disabled
IIS-IIS6ManagementCompatibility Disabled
IIS-IISCertificateMappingAuthentication Disabled
IIS-IPSecurity Disabled
IIS-ISAPIExtensions Disabled
IIS-ISAPIFilter Disabled
IIS-LegacyScripts Disabled
IIS-LegacySnapIn Disabled
IIS-LoggingLibraries Disabled
IIS-ManagementConsole Disabled
IIS-ManagementScriptingTools Disabled
IIS-ManagementService Disabled
IIS-Metabase Disabled
IIS-NetFxExtensibility Disabled
IIS-NetFxExtensibility45 Disabled
IIS-ODBCLogging Disabled
IIS-Performance Disabled
IIS-RequestFiltering Disabled
IIS-RequestMonitor Disabled
IIS-Security Disabled
IIS-ServerSideIncludes Disabled
IIS-StaticContent Disabled
IIS-URLAuthorization Disabled
IIS-WebDAV Disabled
IIS-WebServer Disabled
IIS-WebServerManagementTools Disabled
IIS-WebServerRole Disabled
IIS-WebSockets Disabled
IIS-WindowsAuthentication Disabled
IIS-WMICompatibility Disabled
Похожие на сервер окон, вы можете установить функции выше, выполнив следующую или что-то подобное (вы можно установить несколько функций с помощью запятой, чтобы отделить значения от параметра FeatureName:
#you can add -NoRestart to prevent automatic restarting (if required)
Enable-WindowsOptionalFeature -Online -FeatureName IIS-Webserver
Надежда это помогает
Почему не Google? Вот с чего начать, а не здесь. –
Я использую Google в течение нескольких дней/недель. Скрипты Powershell не являются общими для этого типа задач, и это меня озадачивает. Большинство статей ссылаются на использование самой Powershell вместо сценария. – micah
В чем разница между «сценарием Powershell» и «самой Powershell»? – jscott