Azure AD Connect Invalid class

Tomass Pētersons 336 Reputation points
2024-07-05T13:44:52.05+00:00

Hi,

A couple of days ago the VM was hard rebooted a few times due to technical issues in the data center. There seemed to be no issues with the VM itself, but yesterday I got a message that Azure AD Connect (Entra Connect) is not working. Looking at the services, I see that the Sync and Health Agent services cannot start. Trying to open AD Connect itself throws a weird "Invalid class" error.
6
7

Analyzing the audit logs, I came across several strange errors. It seems to me that something is wrong with the .NET Framework, but I can't really understand the root of the problem.
1
2
3
4
5

I tried to repair Azure AD Connect. I tried to fix the situation with SFC and DISM commands, but nothing.
AD Connect version 2.3.8.0 runs on Windows Server 2022 with all updates. I hope for advice and help.

Thanks!

Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
20,449 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Tomass Pētersons 336 Reputation points
    2024-07-05T16:49:49.3866667+00:00

    This can be seen in the error.log file under C:\Users\ADSyncMSAxxxx$\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances\ADSync2019. Does this mean I just have to be very patient or is there still some involvement required?
    8

    0 comments No comments

  2. Akhilesh 7,070 Reputation points Microsoft Vendor
    2024-07-08T13:54:17.63+00:00

    Hi @Tomass Pētersons

    Thank you for reaching us!

    The "Invalid class" error you are seeing when trying to open AD Connect is typically caused by a corrupted WMI repository
    sometimes simple restart might fix your issue, if still the issue is not fix, try Starting and stopping WMI service if the issue persists same rebuilding the WMI repository on the server where Entra Connect is installed.

    Hope this helps. please let me know if you any further queries.

    Thanks,

    Akhilesh.


    If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.


  3. Tomass Pētersons 336 Reputation points
    2024-07-13T15:48:06.5066667+00:00

    In the end, the problem was really with the WMI classes. When I opened wmimgmt.msc, WMI Control properties showed the following errors -
    Failed to initialize all required WMI classes.
    Win32_Processor: WMI: Invalid class
    Win32 WMISettmg WMI Invalid class
    Security information Successful
    Win32_OperatingSystem WMI Invalid class
    So thanks Akhilesh for the hint to find the root of the problem.

    But to solve the problem, I didn't take drastic steps because I had heard that you need to be very careful with WMI classes. For example here is one article -
    https://techcommunity.microsoft.com/t5/ask-the-performance-team/wmi-repository-corruption-or-not/ba-p/375484
    Searching more specifically for errors in my case, I came across this -
    https://techcommunity.microsoft.com/t5/ask-the-performance-team/wmi-missing-or-failing-wmi-providers-or-invalid-wmi-class/ba-p/375485

    However, as it was already very late, there was no time to spend more time, so I executed the following commands from the Command Prompt side, because somewhere I found a discussion where someone said that it helped in a similar problem -

    cd C:\Windows\system32\wbem
    for /f %s in ('dir /b *.mof *.mfl') do mofcomp %s
    for %i in (*.dll) do regSvr32 -s %i
    net stop winmgmt /y
    net start winmgmt
    gpupdate /force
    

    Initially, it solved the problem, but immediately I noticed other oddities, for example, Server Manager could not be refreshed, throwing the following error -
    Server Manager problem: Online - Data retrieval failures occurred
    Digging around a bit more, I ended up running these commands from the command prompt -

    cd C:\Windows\system32\wbem\AutoRecover
    for /f %s in ('dir /b *.mof *.mfl') do mofcomp %s
    

    It basically restored all the WMI classes. I haven't noticed any more problems and Azure AD Connect is working again.

    0 comments No comments