我正在运行powershell脚本来安装IIS。下面是我的剧本
Add-WindowsFeature NET-Framework-45-ASPNET
Add-WindowsFeature NET-HTTP-Activation
Add-WindowsFeature Telnet-Client
Enable-WindowsOptionalFeature -Online -FeatureName IIS-WebServerRole
Enable-WindowsOptionalFeature -Online -FeatureName IIS-WebServer
Enable-WindowsOptionalFeature -Online -FeatureName IIS-CommonHttpFeatures
Enable-WindowsOptionalFeature -Online -FeatureName IIS-HttpErrors
Enable-WindowsOptionalFeature -Online -FeatureName IIS-HttpRedirect
Enable-WindowsOptionalFeature -Online -FeatureName IIS-ApplicationDevelopment
Enable-WindowsOptionalFeature -Online -FeatureName IIS-NetFxExtensibility45
Enable-WindowsOptionalFeature -Online -FeatureName IIS-HealthAndDiagnostics
Enable-WindowsOptionalFeature -Online -FeatureName IIS-HttpLogging
Enable-WindowsOptionalFeature -Online -FeatureName IIS-LoggingLibraries
Enable-WindowsOptionalFeature -Online -FeatureName IIS-RequestMonitor
Enable-WindowsOptionalFeature -Online -FeatureName IIS-HttpTracing
Enable-WindowsOptionalFeature -Online -FeatureName IIS-Security
Enable-WindowsOptionalFeature -Online -FeatureName IIS-RequestFiltering
Enable-WindowsOptionalFeature -Online -FeatureName IIS-Performance
Enable-WindowsOptionalFeature -Online -FeatureName IIS-WebServerManagementTools
Enable-WindowsOptionalFeature -Online -FeatureName IIS-IIS6ManagementCompatibility
Enable-WindowsOptionalFeature -Online -FeatureName IIS-Metabase
Enable-WindowsOptionalFeature -Online -FeatureName IIS-ManagementConsole
Enable-WindowsOptionalFeature -Online -FeatureName IIS-BasicAuthentication
Enable-WindowsOptionalFeature -Online -FeatureName IIS-WindowsAuthentication
Enable-WindowsOptionalFeature -Online -FeatureName IIS-StaticContent
Enable-WindowsOptionalFeature -Online -FeatureName IIS-DefaultDocument
Enable-WindowsOptionalFeature -Online -FeatureName IIS-WebSockets
Enable-WindowsOptionalFeature -Online -FeatureName IIS-ApplicationInit
Enable-WindowsOptionalFeature -Online -FeatureName IIS-NetFxExtensibility45
Enable-WindowsOptionalFeature -Online -FeatureName IIS-ASPNET45
Enable-WindowsOptionalFeature -Online -FeatureName IIS-ISAPIExtensions
Enable-WindowsOptionalFeature -Online -FeatureName IIS-ISAPIFilter
Enable-WindowsOptionalFeature -Online -FeatureName IIS-HttpCompressionStatic
Add-WindowsFeature Web-Scripting-Tools
Add-WindowsFeature MSMQ
Add-WindowsFeature msmq-server, msmq-triggers
Add-WindowsFeature Web-Ftp-Server我搞错了
启用-WindowsOptionalFeature:禁用一个或多个父功能,因此无法启用当前功能。在C:\SetupScripts\Install-IIS.ps1:34 char:1 + Enable-WindowsOptionalFeature -Online -FeatureName IIS-ASPNET45 45+~~+ CategoryInfo : NotSpecified:(:) Enable-WindowsOptionalFeature,COMException + FullyQualifiedErrorId :NotSpecified
我在这里做错什么了?确定有什么不对劲吗?
发布于 2019-02-07 15:24:01
试着在末尾添加选项-All。在启用指定功能之前,All参数将启用指定功能的所有父特性。将使用默认值启用父功能。
Enable-WindowsOptionalFeature -Online -FeatureName IIS-ASPNET45 -All也请参考https://learn.microsoft.com/en-us/powershell/module/dism/enable-windowsoptionalfeature?view=win10-ps
发布于 2019-01-24 12:22:48
我只是遇到了同样的问题,我发现在安装IIS-ISAPIExtensions之前必须先安装IIS-ASPNET45和IIS-ISAPIFilter。换言之:
...
Enable-WindowsOptionalFeature -Online -FeatureName IIS-ISAPIExtensions
Enable-WindowsOptionalFeature -Online -FeatureName IIS-ISAPIFilter
Enable-WindowsOptionalFeature -Online -FeatureName IIS-ASPNET45
...我不知道有什么简单的方法可以找到另一个特性的父特性。如果它是从Get-WindowsOptionalFeature返回的对象上的属性,那就太好了。
发布于 2020-04-29 11:24:25
您将通过在脚本中添加下面的内容来完成它。
Enable-WindowsOptionalFeature -online -FeatureName NetFx4Extended-ASPNET45https://stackoverflow.com/questions/52002601
复制相似问题