From management studio we do not see the SQL server and SQL Agent status. When we right click the instance, start, stop and resume options is disabled.
WMI Permission could be a cause. Enable below permission in WMI.
--Expand Component Service -> Computers -> My computer
--Right-click and go to the Properties of My Computer
--Select the COM Security Tab
--Click on "Edit Limits"
--Under launch and activation permissions : Add both Startup account of SQLServer service and Logged on windows account.
--On the Start menu on, click Run.
--Type wmimgmt.msc, and then click OK.
--In the Windows Management Infrastructure program, right-click WMI Control (Local), and then click Properties.
--In the WMI Control (Local) Properties dialog box, select Security tab, expand Root, and then click CIMV2.
--Click Security to open the Security for ROOT\CIMV2 dialog box. Add startup account of SQLServer service and Windows Logon account and select Remote Enable permission.
3) Use the following command to give rights to query service .
subinacl /SERVICE MSSQL$SQLINST /GRANT=everyone
NOTE: MSSQL$SQLINST > Replace With your SQLServer service name.
4) We can use below command to reset the Security policy to default.
secedit /configure /cfg C:\WINDOWS\inf\defltsv.inf /db defltsv.sdb /verbose
-->If you still have the same error even after running this.
We can ran the following WMI query to check if we get any errors:
Select * from Win32_service where name="SQLServiceName"
Steps to check SQL Service status from WMI:
--Connect to “root\cimv2”
--Click on notification Query
--Run the below query
--SELECT * FROM __InstanceModificationEvent WITHIN 10 WHERE TargetInstance isa 'Win32_Service'
--Stop SQLAgent or SQLServer service
--check if you get notification query:
Run the below Port query and check if any Instance is misidentified as cluster
a. "IsClustered " Should be no
b. Check browser properties to see if it Standalone
c. Compare the HOST name ,select serverproperty ('servername') , and select @@Servername
All the above three has to match.
--> If query “select serverproperty ('servername')” returns wrong name
Check the environment variable's and see if we have below variables defined. Below keys should be present only for clustered SQLServer and Key "_CLUSTER_NETWORK_NAME_" should have SQLVirtual server name in case of cluster and this Environment variable should not be present for Standalone instance.
Note: Environment variable will be defined for service under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\MSSQL$InstanceName\Environment