During IIS 7 installation on  Windows 2008 and Windows 2008 R2 , if you would receive failure message " The server needs to be restarted to undo the changes".



Immediately after the IIS 7 error, another error message is displayed "  Windows must be re-installed ".



Probable cause: 

You would likely to get aforementioned errors during IIS 7 installation if Windows Servers are activated through KMS. In this scenario, Windows was not completely activated ( though you could see OS has been activated in System Info ); hence OS prevented IIS installation.

Resolution:

Fix for 2008 :

1.      Go to  following folder C:\Windows\ServiceProfiles\NetworkService\AppData\Roaming\Microsoft.

2.     Right click SoftwareLicensing folder,  in the security add user slsvc ( NT Service\slsvc – local service account) and provide full control.

3.      Install IIS.

Fix for 2008 R2 :

 1.      Go to  following folder C:\Windows\ServiceProfiles\NetworkService\AppData\Roaming\Microsoft.

2.      Right click SoftwareProtectionPlatform folder,  in the security add user sppsvc (NT Service\sppsvc – local service account) and provide full control.

3.      Install IIS.

P.S. : Please note the difference between 2008 and 2008 R2 fix. Also,  AppData is a hidden folder !