trimble-oss / dba-dash

DBA Dash - SQL Server Monitoring Tool
MIT License
252 stars 58 forks source link

Access Denied Despite gmsa account has SA and is part of local admin group #949

Closed aachaemenes closed 1 week ago

aachaemenes commented 1 month ago

Getting this

System.AggregateException: Error connecting to WMI on (Access is denied.) (Access is denied. ) ---> Microsoft.Management.Infrastructure.CimException: Access is denied. at Microsoft.Management.Infrastructure.Internal.Operations.CimSyncEnumeratorBase1.MoveNext() at System.Linq.Enumerable.TryGetSingle[TSource](IEnumerable1 source, Boolean& found) at System.Linq.Enumerable.Single[TSource](IEnumerable1 source) at Microsoft.Management.Infrastructure.CimSession.GetClass(String namespaceName, String className, CimOperationOptions options) at Microsoft.Management.Infrastructure.CimSession.GetClass(String namespaceName, String className) at DBADash.DBCollector.TestWMI(CimSessionOptions sessionOptions) in D:\a\dba-dash\dba-dash\DBADash\DBCollector.cs:line 1484 at DBADash.DBCollector.get_WMISessionOptions() in D:\a\dba-dash\dba-dash\DBADash\DBCollector.cs:line 1452 --- End of inner exception stack trace --- at DBADash.DBCollector.get_WMISessionOptions() in D:\a\dba-dash\dba-dash\DBADash\DBCollector.cs:line 1440 at DBADash.DBCollector.CollectPowerPlanWMI() in D:\a\dba-dash\dba-dash\DBADash\DBCollector.cs:line 1511 ---> (Inner Exception #1) Microsoft.Management.Infrastructure.CimException: Access is denied. at Microsoft.Management.Infrastructure.Internal.Operations.CimSyncEnumeratorBase1.MoveNext() at System.Linq.Enumerable.TryGetSingle[TSource](IEnumerable1 source, Boolean& found) at System.Linq.Enumerable.Single[TSource](IEnumerable1 source) at Microsoft.Management.Infrastructure.CimSession.GetClass(String namespaceName, String className, CimOperationOptions options) at Microsoft.Management.Infrastructure.CimSession.GetClass(String namespaceName, String className) at DBADash.DBCollector.TestWMI(CimSessionOptions sessionOptions) in D:\a\dba-dash\dba-dash\DBADash\DBCollector.cs:line 1484 at DBADash.DBCollector.get_WMISessionOptions() in D:\a\dba-dash\dba-dash\DBADash\DBCollector.cs:line 1462<---

DavidWiseman commented 1 month ago

Hi,

There is some information here on troubleshooting WMI:

https://dbadash.com/docs/help/wmi/

So in addition to local admin, you might need to run Enable-PSRemoting & check firewall rules.

To troubleshoot you can try to run Get-CimInstance -Class Win32_computerSystem -ComputerName "NAME_HERE" from the computer where DBA Dash is installed.

You don't need sysadmin for the WMI collections to work, but you do need local admin.

There is only a minimal amount of information collected through WMI (documented in the link above). The No WMI checkbox can be used to disable WMI if required.

Hope this helps,

David

aachaemenes commented 1 month ago

Thanks for the quick respond here is what i got Get-CimInstance : Access is denied. At line:1 char:1

gmsa account is local admin on the destination server and on the server running dbadash.

aachaemenes commented 1 month ago

I guess that means I have to enable psremoting. Ill give that a shot.

aachaemenes commented 1 month ago

still getting this. account is part of local admin and i ran the enable psremoting.

System.AggregateException: Error connecting to WMI on xxx (Access is denied.) (Access is denied. ) ---> Microsoft.Management.Infrastructure.CimException: Access is denied. at Microsoft.Management.Infrastructure.Internal.Operations.CimSyncEnumeratorBase1.MoveNext() at System.Linq.Enumerable.TryGetSingle[TSource](IEnumerable1 source, Boolean& found) at System.Linq.Enumerable.Single[TSource](IEnumerable1 source) at Microsoft.Management.Infrastructure.CimSession.GetClass(String namespaceName, String className, CimOperationOptions options) at Microsoft.Management.Infrastructure.CimSession.GetClass(String namespaceName, String className) at DBADash.DBCollector.TestWMI(CimSessionOptions sessionOptions) in D:\a\dba-dash\dba-dash\DBADash\DBCollector.cs:line 1484 at DBADash.DBCollector.get_WMISessionOptions() in D:\a\dba-dash\dba-dash\DBADash\DBCollector.cs:line 1452 --- End of inner exception stack trace --- at DBADash.DBCollector.get_WMISessionOptions() in D:\a\dba-dash\dba-dash\DBADash\DBCollector.cs:line 1440 at DBADash.DBCollector.CollectDriversWMI() in D:\a\dba-dash\dba-dash\DBADash\DBCollector.cs:line 1553 ---> (Inner Exception #1) Microsoft.Management.Infrastructure.CimException: Access is denied. at Microsoft.Management.Infrastructure.Internal.Operations.CimSyncEnumeratorBase1.MoveNext() at System.Linq.Enumerable.TryGetSingle[TSource](IEnumerable1 source, Boolean& found) at System.Linq.Enumerable.Single[TSource](IEnumerable1 source) at Microsoft.Management.Infrastructure.CimSession.GetClass(String namespaceName, String className, CimOperationOptions options) at Microsoft.Management.Infrastructure.CimSession.GetClass(String namespaceName, String className) at DBADash.DBCollector.TestWMI(CimSessionOptions sessionOptions) in D:\a\dba-dash\dba-dash\DBADash\DBCollector.cs:line 1484 at DBADash.DBCollector.get_WMISessionOptions() in D:\a\dba-dash\dba-dash\DBADash\DBCollector.cs:line 1462<---

DavidWiseman commented 1 month ago

It should work by default in a domain environment when the service account is a local admin on the remote machine and PSRemoting is enabled. I'm not sure if it works across domain boundaries so if the monitored instance is in a different domain it might not work. It's possible something else other than the Windows firewall could be blocking things or maybe some security configuration/software. If the powershell script is failing to run you might be able to get help for this issue from powershell communities. If you are able to find the root cause, please post back.

If you are unable to get it working remotely you could either disable WMI or run the DBA Dash service directly on the monitored instance (which is less likely to have problems).

aachaemenes commented 1 week ago

It was a permission issue.