用命令行安装IIS(pkgmgr版)

目录

一.安装IIS7

1.基础安装IIS7

2.完整安装IIS7

3.卸载IIS7

二.安装IIS8

1.完整安装IIS8

2.卸载IIS8

三.附录

1.IIS7安装场景对照表


一.安装IIS7

适用于win 7,win server 2008

1.基础安装IIS7

比如跑一下静态页面

@echo off
echo 正在添加IIS功能,这可能需要几分钟时间...

start /w pkgmgr /iu:IIS-WebServerRole;WAS-WindowsActivationService;WAS-ProcessModel;WAS-NetFxEnvironment;WAS-ConfigurationAPI

echo.%errorlevel%
pause

2.完整安装IIS7

比如跑ASP.NET

@echo off
echo 正在添加IIS功能,这可能需要几分钟时间...

start /w pkgmgr /iu:IIS-WebServerRole;IIS-WebServer;IIS-CommonHttpFeatures;IIS-StaticContent;IIS-DefaultDocument;IIS-DirectoryBrowsing;IIS-HttpErrors;IIS-HttpRedirect;IIS-ApplicationDevelopment;IIS-ASPNET;IIS-NetFxExtensibility;IIS-ASP;IIS-ISAPIExtensions;IIS-ISAPIFilter;IIS-ServerSideIncludes;IIS-HealthAndDiagnostics;IIS-HttpLogging;IIS-LoggingLibraries;IIS-RequestMonitor;IIS-HttpTracing;IIS-CustomLogging;IIS-ODBCLogging;IIS-Security;IIS-BasicAuthentication;IIS-WindowsAuthentication;IIS-DigestAuthentication;IIS-ClientCertificateMappingAuthentication;IIS-IISCertificateMappingAuthentication;IIS-URLAuthorization;IIS-RequestFiltering;IIS-IPSecurity;IIS-Performance;IIS-HttpCompressionStatic;IIS-HttpCompressionDynamic;IIS-WebServerManagementTools;IIS-ManagementConsole;IIS-ManagementScriptingTools;IIS-ManagementService;IIS-IIS6ManagementCompatibility;IIS-Metabase;IIS-WMICompatibility;IIS-LegacyScripts;IIS-LegacySnapIn;WAS-WindowsActivationService;WAS-ProcessModel;WAS-NetFxEnvironment;WAS-ConfigurationAPI

echo.%errorlevel%
pause

网上传的,很多缺少“IIS-HttpCompressionStatic;IIS-HttpCompressionDynamic;”,这里是最完整的,在win7和win2008r2上验证通过

3.卸载IIS7

@echo off
echo 正在卸载IIS功能,这可能需要几分钟时间...

start /w pkgmgr /uu:IIS-WebServerRole;WAS-WindowsActivationService;WAS-ProcessModel

echo.%errorlevel%
pause

这样就好,别太聪明。我试过自制的“完整卸载”命令,结果卸载完按要求重启电脑后蓝屏了,再重启也好不了。按上面的做就是对的。

二.安装IIS8

适用于win 8,win server 2012

1.完整安装IIS8

@echo off echo 正在添加IIS8功能,这可能需要几分钟时间... 

start /w pkgmgr /iu:IIS-WebServerRole;IIS-WebServer;IIS-CommonHttpFeatures;IIS-StaticContent;IIS-DefaultDocument;IIS-DirectoryBrowsing;IIS-HttpErrors;IIS-HttpRedirect;IIS-ApplicationDevelopment;IIS-ASPNET;IIS-NetFxExtensibility;NetFx4Extended-ASPNET45;IIS-ASP;IIS-ISAPIExtensions;IIS-ISAPIFilter;IIS-ServerSideIncludes;IIS-HealthAndDiagnostics;IIS-HttpLogging;IIS-LoggingLibraries;IIS-RequestMonitor;IIS-HttpTracing;IIS-CustomLogging;IIS-ODBCLogging;IIS-Security;IIS-BasicAuthentication;IIS-WindowsAuthentication;IIS-DigestAuthentication;IIS-ClientCertificateMappingAuthentication;IIS-IISCertificateMappingAuthentication;IIS-URLAuthorization;IIS-RequestFiltering;IIS-IPSecurity;IIS-Performance;IIS-WebServerManagementTools;IIS-ManagementConsole;IIS-ManagementScriptingTools;IIS-ManagementService;IIS-IIS6ManagementCompatibility;IIS-Metabase;IIS-WMICompatibility;IIS-LegacyScripts;IIS-LegacySnapIn;WAS-WindowsActivationService;WAS-ProcessModel;WAS-NetFxEnvironment;WAS-ConfigurationAPI 

echo.%errorlevel%
echo IIS8安装成功!
pause 

2.卸载IIS8

@echo off
echo 正在卸载IIS功能,这可能需要几分钟时间...

start /w pkgmgr /uu:IIS-WebServerRole;WAS-WindowsActivationService;WAS-ProcessModel

echo.%errorlevel%
pause

三.附录

1.IIS7安装场景对照表

Default Server Install Components

Server Manager Update Name
Static Content IIS-StaticContent
Default Document IIS-DefaultDocument
Directory Browsing IIS-DirectoryBrowsing
HTTP Errors IIS-HttpErrors
HTTP Logging IIS-HttpLogging
Logging Tools IIS-LoggingLibraries
Request Monitor IIS-RequestMonitor
Request Filtering IIS-RequestFiltering
Static Content Compression IIS-HttpCompressionStatic
IIS Management Console IIS-ManagementConsole

ASP.NET Workload Server Options

Server Manager Update Name
Static Content IIS-StaticContent
Default Document IIS-DefaultDocument
Directory Browsing IIS-DirectoryBrowsing
HTTP Errors IIS-HttpErrors
HTTP Logging IIS-HttpLogging
Logging Tools IIS-LoggingLibraries
Request Monitor IIS-RequestMonitor
Request Filtering IIS-RequestFiltering
Static Content Compression IIS-HttpCompressionStatic
IIS Management Console IIS-ManagementConsole
ASP.NET IIS-ASPNET
.NET Extensibility IIS-NetFxExtensibility
ISAPI Filters IIS-ISAPIFilter
ISAPI Extensions IIS-ISAPIExtensions

Class ASP Workload Server Options

Server Manager Update Name
Static Content IIS-StaticContent
Default Document IIS-DefaultDocument
Directory Browsing IIS-DirectoryBrowsing
HTTP Errors IIS-HttpErrors
HTTP Logging IIS-HttpLogging
Logging Tools IIS-LoggingLibraries
Request Monitor IIS-RequestMonitor
Request Filtering IIS-RequestFiltering
Static Content Compression IIS-HttpCompressionStatic
IIS Management Console IIS-ManagementConsole
ASP IIS-ASP
ISAPI Extensions IIS-ISAPIExtensions

 

FastCGI Workload Server Options

Server Manager Update Name
Static Content IIS-StaticContent
Default Document IIS-DefaultDocument
Directory Browsing IIS-DirectoryBrowsing
HTTP Errors IIS-HttpErrors
HTTP Logging IIS-HttpLogging
Logging Tools IIS-LoggingLibraries
Request Monitor IIS-RequestMonitor
Request Filtering IIS-RequestFiltering
Static Content Compression IIS-HttpCompressionStatic
IIS Management Console IIS-ManagementConsole
CGI IIS-CGI

IIS Managed Modules and .NET Extensibility Server Workload

Server Manager Update Name
Static Content IIS-StaticContent
Default Document IIS-DefaultDocument
Directory Browsing IIS-DirectoryBrowsing
HTTP Errors IIS-HttpErrors
HTTP Logging IIS-HttpLogging
Logging Tools IIS-LoggingLibraries
Request Monitor IIS-RequestMonitor
Request Filtering IIS-RequestFiltering
Static Content Compression IIS-HttpCompressionStatic
IIS Management Console IIS-ManagementConsole
.NET Extensibility IIS-NetFxExtensibility

Full Server Install Components

Server Manager Update Name
Internet Information Services IIS-WebServerRole
World Wide Web Services IIS-WebServer
Common HTTP Features IIS-CommonHttpFeatures
Static Content IIS-StaticContent
Default Document IIS-DefaultDocument
Directory Browsing IIS-DirectoryBrowsing
HTTP Errors IIS-HttpErrors
HTTP Redirection IIS-HttpRedirect
Application development IIS-ApplicationDevelopment
ASP.NET IIS-ASPNET
.NET Extensibility IIS-NetFxExtensibility
ASP IIS-ASP
CGI IIS-CGI
ISAPI Extensions IIS-ISAPIExtensions
ISAPI Filters IIS-ISAPIFilter
Ser-Side Includes IIS-ServerSideInclude
Health and diagnostics IIS-HealthAndDiagnostics
HTTP Logging IIS-HttpLogging
Logging Tools IIS-LoggingLibraries
Request Monitor IIS-RequestMonitor
Tracing IIS-HttpTracing
Custom Logging IIS-CustomLogging
ODBC Logging IIS-ODBCLogging
Security IIS-Security
Basic Authentication IIS-BasicAuthenticaition
Windows Authentication IIS-WindowsAuthentication
Digest Authentication IIS-DigestAuthentication
Client Certificate Mapping Authentication IIS-ClientCertificateMappingAuthentication
IIS Client Certificate Mapping Authentication IIS-IISCertificateMappingAuthentication
URL Authorization IIS-URLAuthorization
Request Filtering IIS-RequestFiltering
IP and Domain Restrictions IIS-IPSecurity
Performance IIS-Performance
Static Content Compression IIS-HttpCompressionStatic
Dynamic Content Compression IIS-HttpCompressionDynamic
Management Tools IIS-WebServerManagementTools
IIS Management Console IIS-ManagementConsole
IIS Management Scripts and Tools IIS-ManagementScriptingTools
Management Service IIS-ManagementService
IIS6 Management Compatibility IIS-IIS6ManagementCompatibility
IIS Metabase Compatibility IIS-Metabase
IIS 6 WMI Compatibility IIS-WMICompatibility
IIS 6 Scripting Tools IIS-LegacyScripts
IIS 6 Management Console IIS-LegacySnapin
FTP Publishing Service IIS-FTPPublishingService
FTP Server IIS-FTPServer
FTP Management Console IIS-FTPManagemnt
Windows Process Activation service WAS-WindowsActivationService
Process Model WAS-ProcessModel
.NET Environment WAS-NetFxEnvironment
Configiuration APIs WAS-ConfigurationAPI

你可能感兴趣的:(Windows)