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.

Advertisements
This entry was posted in PowerShell Workflow, SMA and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s