Windows上利用powershell安装dotnet和iis

Windows2012*/2016/2019利用powershell安装dotnet和iis非常简单,前提:服务器有外网

运行powershell输入Get-WindowsFeature -Name NET-*, Web-* | where {$_.Name -notmatch "Web-Application-Proxy"} | Install-WindowsFeature这句命令就可以了

这里要提一下的是,Get-WindowsFeature -Name NET-*, Web-* 过滤到的项中有个Web 应用程序代理(Web-Application-Proxy)不是我们需要的,要剔除

如果不想要IIS-Ftp-Server,可以输入Get-WindowsFeature -Name Web-FtP* | Uninstall-WindowsFeature卸载

以上2步可以一句命令搞定:Get-WindowsFeature -Name NET-*, Web-* | where {$_.Name -notmatch "Ftp|Web-Application-Proxy"} | Install-WindowsFeature

如上图,有百分比的进度显示

如果是2008安装IIS,把下面这段命令另存为.bat文件执行即可

========================================================================

start /w pkgmgr /iu:TelnetClient;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-CGI;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;IIS-FTPServer;IIS-FTPSvc;IIS-FTPExtensibility;IIS-WebDAV;IIS-HostableWebCore

pause

========================================================================

如果不想要IIS-Ftp-Server,另存为.bat文件时可以去掉结尾处斜体显示IIS-FTPServer;IIS-FTPSvc;IIS-FTPExtensibility;

相关文章

Windows2012R2备用域控搭建 前置操作 域控主域控的主dns:自...
主域控角色迁移和夺取(转载) 转载自:http://yupeizhi.blo...
Windows2012R2 NTP时间同步 Windows2012R2里没有了internet时...
Windows注册表操作基础代码 Windows下对注册表进行操作使用的...
黑客常用WinAPI函数整理之前的博客写了很多关于Windows编程的...
一个简单的Windows Socket可复用框架说起网络编程,无非是建...