IIS 7.0/Unable to uninstall IIS 7.0 on Windows Server 2008 - CBS corrupt issue.

We were trying to troubleshoot one of the issues on our IIS 7.0 and wanted to uninstall and then re-install IIS 7.0 server.But each time we uninstalled IIS and rebooted the IIS server, we saw at Start-up that server was trying to configure updates and it was failing, warning that installation of update was not successful.

In event logs found the following entry with different package name.

Log Name: System
Source: Microsoft-Windows-Servicing
Date: 10/26/2009 4:29:05 PM
Event ID: 4375
Task Category: None
Level: Error
Keywords: Classic
User: N/A
Computer: <Computer Name>
Description:
Windows Servicing failed to complete the process of setting package WUClient-SelfUpdate-Core~31bf3856ad364e35~amd64~~7.2.6001.788 () into Installed(Installed) state
Event Xml:
<Event xmlns="https://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="Microsoft-Windows-Servicing" Guid="{bd13f3b8-fc40-4a61-a307-b7a013a069c1}" EventSourceName="Microsoft-Windows-Servicing" />
<EventID Qualifiers="49152">4375</EventID>
<Version>0</Version>
<Level>2</Level>
<Task>0</Task>
<Opcode>0</Opcode>
<Keywords>0x80000000000000</Keywords>
<TimeCreated SystemTime="2009-10-26T20:29:05.000Z" />
<EventRecordID>175445</EventRecordID>
<Correlation />
<Execution ProcessID="0" ThreadID="0" />
<Channel>System</Channel>
<Computer><ComputerName></Computer>
<Security />
</System>
<UserData>
<CbsPackageChangeState xmlns="https://manifests.microsoft.com/win/2004/08/windows/setup_provider">
<PackageIdentifier>WUClient-SelfUpdate-Core~31bf3856ad364e35~amd64~~7.2.6001.788</PackageIdentifier>
<ReleaseType>
</ReleaseType>
<PackageState>Installed</PackageState>
<PackageAssembly>WUClient-SelfUpdate-Core~31bf3856ad364e35~amd64~~7.2.6001.788</PackageAssembly>
<Operation>Installed</Operation>
<OperationCompleted>True</OperationCompleted>
<ErrorCode>0x800f0826</ErrorCode>
<RebootOption>False</RebootOption>
<MissingElements>
</MissingElements>
</CbsPackageChangeState>
</UserData>
</Event>

We went ahead and took back up of IIS configuration by running following command from inetsrv directory. For more details about how to take backup please visit the link, https://blogs.iis.net/bills/archive/2008/03/24/how-to-backup-restore-iis7-configuration.aspx

C:\Windows\System32\inetsrv>appcmd add backup 30102009
BACKUP object "30102009" added

Note: To uninstall Web Server Role from IIS 7.0 server, please make sure that Windows Activation Service Feature is uninstalled. While we try to uninstall WAS, its dependent IIS as well is removed from the box.

Although we tried to remove WAS, which in turn removed IIS, after reboot we found that server was trying to install updates and that was not successful. Something was causing this to happen, which we were not sure about.

What would be the CAUSE?

From the above event viewer entry it was clear that some Windows Servicing failed to complete the process of setting package, WUClient-SelfUpdate-Core, with different package names.

We looked in CBS.log file (C:\windows\Logs\CBS\CBS.log file) and found the following

9-10-26 15:31:47, Info CBS RA: Skipping package: WUClient-SelfUpdate-Core~31bf3856ad364e35~amd64~en-US~7.1.6001.65, not self-owned.
2009-10-26 15:31:47, Info CBS RA: Skipping package: WUClient-SelfUpdate-Core~31bf3856ad364e35~amd64~en-US~7.2.6001.788, not self-owned.
2009-10-26 15:31:47, Info CBS RA: Skipping package: WUClient-SelfUpdate-Core~31bf3856ad364e35~amd64~~7.1.6001.65, not self-owned.
2009-10-26 15:31:47, Info CBS RA: Skipping package: WUClient-SelfUpdate-Core~31bf3856ad364e35~amd64~~7.2.6001.788, not self-owned.

Note: The above are examples of few package names.

There was more such patches, infact there were more such patches that are stuck in Pending State. We confirmed that from registry, HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\PackagesPending

We would see PackagesPending Key in registry, when the patches are struck in Pending State. This state had blocked the CBS (Component based Servicing) for this server.

In Windows Server 2008, CBS is the key installer for anything you need to install on this box.That includes IIS and other roles that might depend on CBS. In this current state, we will not be able to install any roles on this box.

We get into such state(PackagesPending) when we have CORRUPT UPDATE forced to be installed on the box.

How can we RESOLVE above issue?

We need to Run checksur by following KB, https://support.microsoft.com/kb/947821

Once we fix the CBS corrupt issue, we were able to uninstall and re-install IIS fine. We did not get any startup warning messages about the updates not getting installed properly.

Catch you later,

Vandana.