Service Manager SMA Troubleshooting

SCSM – SMLets “The criteria could not be parsed. See inner exception for details.”

If you are using the SMLets from codeplex in combination with PowerShell remoting to retrieve information from Service Manager it could well be that you hit this error:

The criteria could not be parsed. See inner exception for details.

    + CategoryInfo          : OperationStopped: (:) [], InvalidCriteriaException

    + FullyQualifiedErrorId : The criteria could not be parsed. See inner exception for details.

+ PSComputerName        : Computer1

In my case the setup consisted out of 2 infrastructures like a TEST and an INTEGRATION which were supposed to be identical. In both environment we had SMA and Service Manager installed. I wanted to run a PowerShell workflow in SMA to retrieve the service request id from a newly generated service request. The fun part was that executing the code within the INTEGRATION environment did not cause any problem but if I executed the code in the TEST environment I faced the error above. The code part which generated the error was:

 

$SRID = “SR445”

$SRClass = Get-SCSMClass –Name “System.WorkItem.ServiceRequest$”

$SRObject = Get-SCSMObject -Class $SRClass -Filter “ID -eq $SRID”

If I used Where-Object like…

 

$SRID = “SR445”

$SRClass = Get-SCSMClass –Name “System.WorkItem.ServiceRequest$”

$SRObject = Get-SCSMObject -Class $SRClass | Where-Object {$_.ID -eq $SRID”}

 

or if I used the Name property to filter the service requests like…

 

$SRID = “SR445”

$SRClass = Get-SCSMClass –Name “System.WorkItem.ServiceRequest$”

$SRObject = Get-SCSMObject -Class $SRClass -Filter “Name -eq $SRID”

 

I did NOT hit any error! So the part which caused the failure was the -Filter “ID -eq $SRID” statement. Again, I just received the error in the TEST environment. In the INTEGRATION environment all the above samples worked as expected! So what was wrong? After a long time of troubleshooting and comparing the environments my fellow and automation guru Fulvio Ferrarini finally found the cause of the problem (all credits to him).

If you check the inner exception to get more details you find this error:

 

Exception of type ‘System.OutOfMemoryException’ was thrown.

    + CategoryInfo          : OperationStopped: (:) [], OutOfMemoryException

    + FullyQualifiedErrorId : Exception of type ‘System.OutOfMemoryException’ was thrown.

    + PSComputerName        : Computer1

 

What the hell?

To execute the PowerShell workflow on the remote Service Manager from SMA I was using InlineScript{} and PowerShell remoting. Because of that by comparing the WinRM (Windows Remote Management) settings on the Service Manager server there was a major difference:

INTEGRATION

image

TEST

image

MaxMemoryPerShellMB was reduced to 300 MB by a GPO! After adjusting the GPO everything worked as expected…

image

I hope this delivers you the proper hint if you run into a similar issue.

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.