Fix CLSID 0X80040166 (CS_E_CLASS_NOTFOUND) in 3 steps
The COM class ID isn't registered in Active Directory's software installation data. Usually caused by broken MSI package references or stale user profiles.
Quick answer (for the impatient)
Re-register the failing COM class using regsvr32 or reinstall the associated MSI package. Then run gpupdate /force and restart.
Why you're seeing 0X80040166
This error always means Windows can't find a COM class ID (CLSID) in Active Directory's software installation data. It's almost always a registry or AD problem — the class was registered once, then something broke it. Common triggers: you migrated the user profile from an old domain, a Group Policy changed the assigned software, or an MSI package got uninstalled without cleaning up its COM entries. I see this most often after domain migrations or when someone force-removed an enterprise app like an old VPN client or backup agent.
The exact code CS_E_CLASS_NOTFOUND (0x80040166) comes from Component Services. The OS doesn't just fail — it tells you the class doesn't exist in the Active Directory database at all.
Step-by-step fix
- Identify the failing CLSID — Check Application Event Log for the exact GUID (looks like
{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}). Open Event Viewer (eventvwr.msc), filter on SourceCOMorDistributedCOMand find the error with ID 10001 or 10002. - Re-register the class — Open regedit (
regedit), go toHKEY_CLASSES_ROOT\CLSID\{GUID}. If the key's missing or empty, runregsvr32 path\to\dll_or_ocxfor the component that owns it. If you don't know the owner, search the GUID online or check the software's install folder for a.manifestfile. - Repair the Active Directory data — On a domain controller, run
ADSI Edit(adsiedit.msc). Navigate toCN=Class Registration, CN=Software Installation, CN=Computer, CN=System, DC=yourdomain, DC=com. Find the CLSID entry and delete it. Then force Group Policy update:gpupdate /forceon the affected workstation, reboot.
If the main fix doesn't work
Try these in order:
- Run System File Checker —
sfc /scannowthenDISM /Online /Cleanup-Image /RestoreHealth. Corrupted system files can ghost COM registrations. - Create a new user profile — If the error only appears for one user, their profile probably has a stale registry hive. Back up their data, delete the profile via System Properties > Advanced > User Profiles, and have them log in fresh.
- Force reinstall the software — If it's an enterprise-app, run the original MSI with
msiexec /x {product-code}thenmsiexec /i {product-code}from the deployment share. This resets the AD Class Registration.
How to prevent it
Don't force-uninstall enterprise software manually. Always use the original MSI or the installer's uninstaller. When migrating user profiles between domains, run FixMyProfile (free tool from Microsoft) which cleans orphaned CLSID references. Also, schedule monthly event log audits for DistributedCOM errors — catch them before someone files a ticket.
One last thing: if you're using Windows 10/11 with the October 2022 or later update, the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Compatibility\CLSID can cause this exact error. Delete any entries under that key that match the failing GUID.Was this solution helpful?