标题。我似乎无法让这个工作,我很生气。 Windows 2012R2数据中心。以下源代码直接来自安装CD中的install.wim文件。它出错并出现以下错误:
The server could not update the provided feature files in the time allowed
下面是代码,请注意它显示了我正在尝试安装的功能。从理论上讲,这不应该是Windows更新(我认为)。 OTOH,我是开发人员,而不是Windows管理员,所以老实说我不知道底层行为应该是什么。这就是我在这里的原因,此时我已经尝试了所有我能想到的。
在什么情况下会发生此错误,我该如何解决?
$features = Get-Features
$source = "wim:C:\WindowsCore\install.wim:4"
Install-WindowsFeature -Name $features -IncludeManagementTools -Source $source -WarningAction SilentlyContinue | Out-Null
function Get-Features {
return [string[]] @(
'FileAndStorage-Services'
'Storage-Services'
'Web-Server'
'Web-WebServer'
'Web-Common-Http'
'Web-Default-Doc'
'Web-Dir-Browsing'
'Web-Http-Errors'
'Web-Static-Content'
'Web-Http-Redirect'
'Web-Health'
'Web-Http-Logging'
'Web-Log-Libraries'
'Web-ODBC-Logging'
'Web-Request-Monitor'
'Web-Http-Tracing'
'Web-Performance'
'Web-Stat-Compression'
'Web-Dyn-Compression'
'Web-Security'
'Web-Filtering'
'Web-Basic-Auth'
'Web-Client-Auth'
'Web-Digest-Auth'
'Web-Cert-Auth'
'Web-IP-Security'
'Web-Url-Auth'
'Web-Windows-Auth'
'Web-App-Dev'
'Web-Net-Ext'
'Web-Net-Ext45'
'Web-ASP'
'Web-Asp-Net'
'Web-Asp-Net45'
'Web-CGI'
'Web-ISAPI-Ext'
'Web-ISAPI-Filter'
'Web-Includes'
'Web-WebSockets'
'Web-Ftp-Server'
'Web-Ftp-Service'
'Web-Mgmt-Tools'
'Web-Mgmt-Console'
'Web-Mgmt-Compat'
'Web-Metabase'
'Web-Lgcy-Mgmt-Console'
'Web-Lgcy-Scripting'
'Web-WMI'
'Web-Scripting-Tools'
'Web-Mgmt-Service'
'NET-Framework-Features'
'NET-Framework-Core'
'NET-Framework-45-Features'
'NET-Framework-45-Core'
'NET-Framework-45-ASPNET'
'NET-WCF-Services45'
'NET-WCF-HTTP-Activation45'
'NET-WCF-TCP-PortSharing45'
'RSAT'
'RSAT-Feature-Tools'
'RSAT-SMTP'
'RSAT-SNMP'
'FS-SMB1'
'SMTP-Server'
'SNMP-Service'
'User-Interfaces-Infra'
'Server-Gui-Mgmt-Infra'
'Server-Gui-Shell'
'PowerShellRoot'
'PowerShell'
'PowerShell-V2'
'PowerShell-ISE'
'WAS'
'WAS-Process-Model'
'WAS-Config-APIs'
'WoW64-Support'
)
}
答案 0 :(得分:0)
我还尝试使用Install-WindowsFeature cmdlet在安装程序中安装多个功能。我最后使用 dism ,因为它似乎不太容易出错。您至少可以尝试一下,也许会得到更详细的错误消息。这是脚本:
$featuresToInstall = ('FileAndStorage-Services','Storage-Services','Web-Server','Web-WebServer','Web-Common-Http','Web-Default-Doc','Web-Dir-Browsing','Web-Http-Errors',
'Web-Static-Content','Web-Http-Redirect','Web-Health','Web-Http-Logging','Web-Log-Libraries','Web-ODBC-Logging','Web-Request-Monitor',
'Web-Http-Tracing','Web-Performance','Web-Stat-Compression','Web-Dyn-Compression','Web-Security','Web-Filtering','Web-Basic-Auth',
'Web-Client-Auth','Web-Digest-Auth','Web-Cert-Auth','Web-IP-Security','Web-Url-Auth','Web-Windows-Auth','Web-App-Dev','Web-Net-Ext',
'Web-Net-Ext45','Web-ASP','Web-Asp-Net','Web-Asp-Net45','Web-CGI','Web-ISAPI-Ext','Web-ISAPI-Filter','Web-Includes','Web-WebSockets',
'Web-Ftp-Server','Web-Ftp-Service','Web-Mgmt-Tools','Web-Mgmt-Console','Web-Mgmt-Compat','Web-Metabase','Web-Lgcy-Mgmt-Console','Web-Lgcy-Scripting',
'Web-WMI','Web-Scripting-Tools','Web-Mgmt-Service','NET-Framework-Features','NET-Framework-Core','NET-Framework-45-Features','NET-Framework-45-Core',
'NET-Framework-45-ASPNET','NET-WCF-Services45','NET-WCF-HTTP-Activation45','NET-WCF-TCP-PortSharing45','RSAT','RSAT-Feature-Tools','RSAT-SMTP',
'RSAT-SNMP','FS-SMB1','SMTP-Server','SNMP-Service','User-Interfaces-Infra','Server-Gui-Mgmt-Infra','Server-Gui-Shell','PowerShellRoot','PowerShell',
'PowerShell-V2','PowerShell-ISE','WAS','WAS-Process-Model','WAS-Config-APIs','WoW64-Support')
# Remove any feature that is not available to prevent dism failures. MSMQ-Container for example is only available
# on Windows 7 but not on Windows Server 2008 R2.
$availableFeatures = dism /online /Get-Features
$featuresToRemove = @()
$featuresToInstall | % { if (-not ($availableFeatures | Select-String ('{0}$' -f $_) -Quiet)) { $featuresToRemove += $_} }
$featuresToInstall = Compare-Object -ReferenceObject $featuresToInstall -DifferenceObject $featuresToRemove | select -ExpandProperty InputObject
$dismParameter = @('/online', '/Enable-Feature', ($featuresToInstall | % { '/FeatureName:{0}' -f $_ }), '/NoRestart', '/all')
$output = dism @dismParameter
# throw an error if dism wasn't successful
if ($global:LastExitCode -ne 0)
{
throw 'Error while installing Windows Features. {0}' -f ($output | Select-String '\.log$')
}
脚本还验证该功能是否可以使用dism进行安装,并在这种情况下将其删除(您可以检查$ featuresToRemove)。
答案 1 :(得分:0)
在Windows服务器2的非核心安装中没有功能,其中一个是net-framework-core(我忘了它是另一个),这就是为什么你指向wim中的源代码,如MS kb州,但这大部分时间都失败了。 而不是将源指向wimfile,你应该将它指向安装介质的\ sources \ sxs位置,这总是对我有用(你也可以指向带有文件的网络位置)