SMA and Powershell Workflow Reserved Words

While troubleshooting a runbook in SMA, I found a reserved word that to my knowledge is not documented anywhere currently.

You cannot use $class as a variable in PowerShell workflow or SMA unless in an inlinescript block

This was the error I ran into:

The following errors were encountered while processing the workflow tree: ‘DynamicActivity’: The private implementation of activity ‘1: DynamicActivity’ has the following validation error: Compiler error(s) encountered processing expression “class”. Expression expected.

Results of a test runbook

clip_image002[4]

Runbook Source

clip_image003[4]

I was running a common SMLets command to get a Service manager class and named my variable $class in a SMA workflow.

Here is an example tested outside of SMA to test if the error was only related to SMA or if this is actually a reserved word in PowerShell workflow.

clip_image005[4]

This has been verified with the SMA product team and they will be looking into if there is any other reserved words we should be aware of while writing runbooks and they will be posting an official blog post on the Orchestrator Engineering Blog.

I did find this older blog post that talks about possibly making class a reserved word.

Be aware that any reserved words in PowerShell are still reserved words in PowerShell workflow and SMA since PowerShell workflow inherits all of the reserved words from PowerShell.

Leave a Reply

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