Windows系统使用批处理(bat)脚本自动安装与卸载 IIS

Windowsx系统使用批处理bat)脚本自动安装卸载 IIS

IIS7X:适用于win 7、win server 2008

@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-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 IIS已添加成功!
pause

IIS8X:适用于win 8、win server 2012

@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 IIS8安装成功!
pause

IIS6:适用于win server 2003

:: *******************
:: * 安装
:: *******************
:Install
Cls
@echo. && @echo 安装正在进行中...
:: 生成 IIS 6.0 安装脚本,启用 ASP,ASP.NET
@echo [Components]> %TEMP%\IIS_Install.txt
@echo iis_common = ON>> %TEMP%\IIS_Install.txt
@echo iis_www = ON>> %TEMP%\IIS_Install.txt
@echo iis_asp = ON>> %TEMP%\IIS_Install.txt
@echo iis_inetmgr = ON>> %TEMP%\IIS_Install.txt
@echo aspnet = ON>> %TEMP%\IIS_Install.txt
:: 安装 IIS 6.0
%windir%\System32\Sysocmgr.exe /i:sysoc.inf /u:%TEMP%\IIS_Install.txt
del /q /f %windir%\*.log >nul 2>nul
del /q /f %TEMP%\IIS_Install.txt >nul 2>nul
del /q /f %TEMP%\ASPNETSetup.log >nul 2>nul
:: 配置 IIS 启用父路径
@cscript /nologo C:\Inetpub\AdminScripts\adsutil.vbs set W3SVC/AspEnableParentPaths 1 >nul 2>nul
Goto Install_End

IIS组件的动态安装方法(WIN7和WIN7以上版本才能只能执行) 保存为bat文件,右键管理员运行

dism.exe /online /NoRestart /enable-feature /featurename:NetFx3
dism.exe /online /NoRestart /enable-feature /featurename:IIS-WebServerRole
dism.exe /online /NoRestart /enable-feature /featurename:IIS-WebServer
dism.exe /online /NoRestart /enable-feature /featurename:IIS-CommonHttpFeatures
dism.exe /online /NoRestart /enable-feature /featurename:IIS-HttpErrors
dism.exe /online /NoRestart /enable-feature /featurename:IIS-HttpRedirect
dism.exe /online /NoRestart /enable-feature /featurename:IIS-ApplicationDevelopment
dism.exe /online /NoRestart /enable-feature /featurename:IIS-Security
dism.exe /online /NoRestart /enable-feature /featurename:IIS-URLAuthorization
dism.exe /online /NoRestart /enable-feature /featurename:IIS-RequestFiltering
dism.exe /online /NoRestart /enable-feature /all /featurename:IIS-NetFxExtensibility
dism.exe /online /NoRestart /enable-feature /featurename:IIS-NetFxExtensibility45
dism.exe /online /NoRestart /enable-feature /featurename:IIS-HealthAndDiagnostics
dism.exe /online /NoRestart /enable-feature /featurename:IIS-HttpLogging
dism.exe /online /NoRestart /enable-feature /featurename:IIS-LoggingLibraries
dism.exe /online /NoRestart /enable-feature /featurename:IIS-RequestMonitor
dism.exe /online /NoRestart /enable-feature /featurename:IIS-HttpTracing
dism.exe /online /NoRestart /enable-feature /featurename:IIS-IPSecurity
dism.exe /online /NoRestart /enable-feature /featurename:IIS-Performance
dism.exe /online /NoRestart /enable-feature /featurename:IIS-HttpCompressionDynamic
dism.exe /online /NoRestart /enable-feature /featurename:IIS-ManagementScriptingTools
dism.exe /online /NoRestart /enable-feature /featurename:IIS-IIS6ManagementCompatibility
dism.exe /online /NoRestart /enable-feature /featurename:IIS-WebServerManagementTools
dism.exe /online /NoRestart /enable-feature /featurename:IIS-Metabase
dism.exe /online /NoRestart /enable-feature /featurename:IIS-HostableWebCore
dism.exe /online /NoRestart /enable-feature /featurename:IIS-CertProvider
dism.exe /online /NoRestart /enable-feature /featurename:IIS-ISAPIExtensions
dism.exe /online /NoRestart /enable-feature /featurename:IIS-ISAPIFilter
dism.exe /online /NoRestart /enable-feature /featurename:IIS-StaticContent
dism.exe /online /NoRestart /enable-feature /featurename:IIS-DefaultDocument
dism.exe /online /NoRestart /enable-feature /featurename:IIS-DirectoryBrowsing
dism.exe /online /NoRestart /enable-feature /featurename:IIS-WebDAV
dism.exe /online /NoRestart /enable-feature /featurename:IIS-WebSockets
dism.exe /online /NoRestart /enable-feature /featurename:IIS-ApplicationInit
dism.exe /online /NoRestart /enable-feature /featurename:IIS-ASPNET
dism.exe /online /NoRestart /enable-feature /featurename:IIS-ASPNET45
dism.exe /online /NoRestart /enable-feature /featurename:NetFx4Extended-ASPNET45
dism.exe /online /NoRestart /enable-feature /featurename:IIS-ASP
dism.exe /online /NoRestart /enable-feature /featurename:IIS-CGI
dism.exe /online /NoRestart /enable-feature /featurename:IIS-ServerSideIncludes
dism.exe /online /NoRestart /enable-feature /featurename:IIS-CustomLogging
dism.exe /online /NoRestart /enable-feature /featurename:IIS-BasicAuthentication
dism.exe /online /NoRestart /enable-feature /featurename:IIS-HttpCompressionStatic
dism.exe /online /NoRestart /enable-feature /featurename:IIS-ManagementConsole
dism.exe /online /NoRestart /enable-feature /featurename:IIS-ManagementService
dism.exe /online /NoRestart /enable-feature /featurename:IIS-WMICompatibility
dism.exe /online /NoRestart /enable-feature /featurename:IIS-LegacyScripts
dism.exe /online /NoRestart /enable-feature /featurename:IIS-LegacySnapIn
dism.exe /online /NoRestart /enable-feature /featurename:IIS-FTPServer
dism.exe /online /NoRestart /enable-feature /featurename:IIS-FTPSvc
dism.exe /online /NoRestart /enable-feature /featurename:IIS-FTPExtensibility
dism.exe /online /NoRestart /enable-feature /featurename:IIS-WindowsAuthentication
dism.exe /online /NoRestart /enable-feature /featurename:IIS-DigestAuthentication
dism.exe /online /NoRestart /enable-feature /featurename:IIS-ClientCertificateMappingAuthentication
dism.exe /online /NoRestart /enable-feature /featurename:IIS-IISCertificateMappingAuthentication
dism.exe /online /NoRestart /enable-feature /featurename:IIS-ODBCLogging
dism.exe /online /NoRestart /enable-feature /featurename:IIS-FTPExtensibility

卸载IIS就比较统一了,请看下面~~

@echo off
color 0a
echo 正在卸载IIS功能,这可能需要几分钟时间...
start /w pkgmgr /uu:IIS-WebServerRole;WAS-WindowsActivationService;WAS-ProcessModel
echo IIS已卸载成功!
pause

 

所写所说,是心之所感,思之所悟,行之所得;文当无敷衍,落笔求简洁。 以所舍,求所获;有所依,方所成!

更多请关注:老梁`s Blog

免责声明,若由于商用引起版权纠纷,一切责任均由使用者承担。 您必须遵守我们的协议,如果您下载了该资源行为将被视为对《免责声明》全部内容的认可->联系老梁投诉资源
Laoliang.Net资源全部来自互联网收集,仅供用于学习和交流,请勿用于商业用途。如有侵权、不妥之处,请联系站长并出示版权证明以便删除。 敬请谅解! 侵权删帖/违法举报/投稿等事物联系邮箱:service@laoliang.net
老梁`s Blog(老梁博客) » Windows系统使用批处理(bat)脚本自动安装与卸载 IIS

发表评论

本站承接,网站推广(SEM,SEO),软件的安装的安装与调试,服务器的推荐以及配置,APP的开发与维护,网络或者web维护;财务软件,客户管理系统,人力资源,超市POS,医药管理,服务器安全,ecshop,金蝶,用友,管家婆;

立即查看 了解详情