Windows上利用powershell安装dotnet和iis

2024-09-26 11:41:13 浏览数 (2)

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

如果只是单纯安装iis ftp server的话,执行:Get-WindowsFeature Web-Ftp-*,Web-Mgmt-Tools,Web-Mgmt-Console|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;

0 人点赞