在Windows系統中用批處理腳本自動安裝以及自動卸載IIS的方式方法
[重要通告]如您遇疑難雜癥,本站支持知識付費業務,掃右邊二維碼加博主微信,可節省您寶貴時間哦!
作為一個小站長,或者說搜索這篇文章的人,估計都是會一些網絡建設的人,那用到IIS是必然,很多時間大家都在說安裝IIS很困難,其實自我感覺還挺簡單的吧,今天就來整理一下bat安裝IIS,運行一次,五分鐘不用動,解決問題的方式,具體請看哦;
安裝IIS
使用批處理命令自動安裝IIS。
注:以下代碼片段保存為.bat
格式即可。
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
IIS7:適用于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
IIS8:適用于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
卸載IIS
使用批處理命令自動卸載IIS。
@echo off
color 0a
echo 正在卸載IIS功能,這可能需要幾分鐘時間...
start /w pkgmgr /uu:IIS-WebServerRole;WAS-WindowsActivationService;WAS-ProcessModel
echo IIS已卸載成功!
pause
以上是IIS8含以及以上的IIS用批處理bat方式安裝的,2019的,直接看站內文章吧;
windows server 2019/2016IIS安裝及相關設置(配置)
以上內容均可保存為Bat來運行,如不想保存設置,請支付一點兒辛苦維護費可直接下載運行;
問題未解決?付費解決問題加Q或微信 2589053300 (即Q號又微信號)右上方掃一掃可加博主微信
所寫所說,是心之所感,思之所悟,行之所得;文當無敷衍,落筆求簡潔。 以所舍,求所獲;有所依,方所成!
win7 測試無效
@tp900: 這個是個硬茬子,不太好解決,很多客戶都沒有解決!