Lỗi windows server roles and features cannot be automatically installed năm 2024
This article shows how to install and remove Windows Server roles and features by using Server Manager. Use the following steps to add Windows roles and features:
On the Confirmation page, verify the changes before proceeding. If you want the server to restart automatically after installation completes, check the box labeled Restart the destination server automatically if required. Although Windows Server roles and features can be automatically installed from the Server Manager, some of those features require source files. For instance, when I’ve tried to install .Net Framework via the Windows Features Control Panel I have received the error message: The following feature couldn’t be installed: .Net Framework 3.5 (includes .NET 2.0 and 3.0) A similar error message appeared when I have tried to install .Net Framework 3.5 using the Server Manager: The request to add or remove features on the specified server failed. To fix this problem, we’ll have to provide source files for the .NET Framework installation. So, open File Explorer and double click the Windows Server ISO image to map the image in Explorer. Run the .NET Framework installation again and in the Confirmation screen click on the “Specify an alternate source path” link. Now, browse the mapped ISO image and navigate to X:\Sources\SxS where X: represents the drive letter that was used to map the ISO image. Please note, if you select X:\Sources folder it will not work, you have to choose the SxS folder. After the source files folder has been selected, you should be able to install .NET Framework 3.5 along with .NET 2.0 and 3.0 without any issues. On a default installation of Windows Server 2012 sometimes you experience problems with the .NET Framework 3.5 features while trying to enable it. It fails if you try to install it using the Add Roles and Features Wizard, using Powershell or dism. .NET Framework 3.5 features installation failureThe same happens during an SQL Server installation with the following error message: The following error has occurred: Error while enabling Windows feature: NetFx3, Error Code: -2146498298, Please try enabling Windows feature: NetFx3 from Windows management tools and then run setup again.Error while enabling Windows feature: NetFx3 SolutionGUIOn the Add Roles and Features Wizard’s Confirmation page spot the difference: On the top of the page there is an exclamation mark and a short message about missing source files. This simply means that you selected one or more roles and features which files are not available for the operating system at the moment. To amend this select the Sepcify an alternate source path on the bottom of the page. On this new window enter the path to your Windows Server 2012 sources/sxs folder. The WIM file won’t work, you need the previously mentioned folder! Alternate source pathThat’s all using the GUI, sorted. PowershellTo do the same thing using Powershell type the following command: Install-WindowsFeature NET-Framework-Core -Source D:\sources\sxs Where NET-Framework-Core is the feature’s name, and D:\sources\sxs is a folder on the Windows Server 2012 media. Install .NET Framework 3.5 features using PowershellCommand promptYou can do the same thing from a command prompt, using dism.exe: dism.exe /online /enable-feature /featurename:netfx3 /all /source:D:\sources\sxs Online swith simply tells dism to do the task on the running system, the feature’s name with dism is netfx3 (remember the SQL server’s error message? It mentioned the same feature name.) and the last part is the alternate path. ExplanationAfter a few solutions to this problem let!s take a look at the reasons behind this error. If you open a Powershell window and query the roles and features (Get-WindowsFeature) take a look at .NET Framework 3.5. Windows roles and features in a Powershell windowIn the last column the Install state is different, it says Removed.
This is the main difference from any other role or feature and this is the reason the installation fails, the source files are not available. Well, this would not be a problem because Windows can also download them from the Internet! So if you never experienced this but installed this feature or SQL multiple times without any issues, the reason is that your machine simply downloaded the files from the Internet. But in some scenarios this is not possible for various reasons. By the way you can uninstall any source files like this for any role or feature and it is called Features on demand, read more about this topic here: Roles, features and the WinSxS folder in Windows Server 2012 With features on demand later, most of the time you specify the install.wim file, but this won’t work with .NET Framework 3.5, because by default the sources are not in there. Does not matter if you specify it with the source parameter, copy the files or mount the wim, the files are not there. That’s why any solution recommending this is wrong. But you can always prepare your own wim file or image with .NET Framework source files already in there, use dism.exe for this task. Summary.NET Framework 3.5 feature installation files are not available by default in a Windows Server 2012 system (neither from the install.wim file) Windows tries to download the files from the Internet. If you want to avoid it or your server cannot access it specify an alternate source path on the Confirmation page of the wizard or use the source parameter of dism.exe or Install-WindowsFeature powershell commandlet. |