"An attempt to connect to WMI" error in enabling always on using Enable-SqlAlwaysOn using powershell

Copper Contributor

Hello, I am getting below error while enabling the SQL Server always on using powershell.

 

*** Enable-SqlAlwaysOn : An attempt to connect to WMI on 'XXXXXXXXXXXX' failed with following error: SQL Server WMI provider is not available on XXXXXXXXXXXX..

 

*** Windows version: Windows Server 2019 Standard Edition

SQL Server Vesrion: SQL Server 2019

 

I have already tried registering mofcomp.exe sqlmgmproviderxpsp2up.mof from command prompt and rebooting the server.

 

Earlier only 13.000 folder was exist in C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.SqlManagement, but I have created 14.000 and 15.000 folder as well and copied the required dll. still did not work.

 

Any help and solution will be appreciated.

 

Thanks, Rahul

2 Replies
If you are using Import-module SqlServer then have you tried Import-Module SqlPS instead? Just to test.
Also, are you using a named instance or the default instance?
Just guessing that the problem is related to the service name MSSQL$<instancename>

> SQL Server WMI provider is not available

The provider is not available so probably the issue is not in the provider but before. Check the firewall for example. Are you running it locally or remotely?

Check this article in the meantime - might solve the issue: http://sqlbeyond.blogspot.com/2010/05/sql-wmi-permission-issue.html