Get-SCOMGroup returns error message “The query processor ran out of internal resources…”

Recently I have been working with several large System Center 2012 R2 Operations Manager (SCOM) environments where the number of groups have been creeping over 1000 which has led to some issues with certain cmdlets.

The Get-SCOMGroup -DisplayName XXX cmdlet is one of those that has been causing problems for some of our automation efforts.

When running this in certain environments we receive the error:

The query processor ran out of internal resources and could not produce a query plan. This is a rare event and only expected for extremely complex queries or queries that reference a very large number of tables or partitions. Please simplify the query. If you believe you have received this message in error, contact Customer Support Services for more information.

This error was generated by the SQL instance behind the Operations Manager DB. After investigating the SQL instances they were behaving well with no errors or performance issues (that I could see but I’m no DBA).

To get around this error involves two lines of PowerShell (three to be 100% certain you’ve got the right object back):

#Get the Class Type where the display name is the name of the group to get
$Class = Get-SCOMClass | ?{$_.DisplayName -eq "<Group Display Name>"}
#Get the instance of the Class (this returns the group)
$Group = Get-SCOMClassInstance -Class $Class
#Optional line:
Get-SCOMGroup -Id $Group.Id

This will return the Group object that you required. The final line is optional but recommended.

One thought on “Get-SCOMGroup returns error message “The query processor ran out of internal resources…”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.