Re-install (repair) Server 2012 Roles & Features

windows-server-2012

Is there a way to re-install all Server Roles & Features in Server 2012?

As far as I can see from Server Manager all that can be done is to manually remove each and then re-install but I am hoping that MS have provided some way of just repairing / re-installing all installed roles & features. Anyone know if there is a way of doing that?

The reason for wanting to do this is that I have a Domain Server which after some recent MS updates has started causing numerous event log warnings & errors and has started behaving erratically.

I know that System File Checker will check installed files but that will not fix any registry permissions problems, which is where I think problems have arisen. Guess what I am looking for is some way to recreate the whole registry and it's permissions but without doing a complete re-install.

Thanks,
Nick

Best Answer

You could use PowerShell and do something like -

import-module ServerManager

Get-WindowsFeature | 
  Where-Object {$_.installed} | 
  Tee-Object -Variable CurrentRoles | 
  Remove-WindowsFeature
$CurrentRoles | 
  Export-CliXML c:\CurrentRoles.xml
Restart-Computer

After the computer reboots -

Import-CliXML c:\CurrentRoles.xml | 
  Add-WindowsFeature
Restart-Computer

I haven't run this exact sequence, so test before running in production, but I have used this pattern for server provisioning.