Workaround for SMA Runbook build failure

Building a robust master SMA Runbook for your automation solutions will have a high chance of ending up with at least a couple of hundreds of lines of code (and magic!). This runbook will most likely consist of runbook nesting, modular workflows, error-handling and fault tolerance which can make things quite complex. Even for the Powershell Engine itself..

One master Runbook I authored ran into a Workflow compilation error when executing the runbook. This because of the sandboxing technology used in SMA and the error appeared because the sandboxed instance could not find the required assemblies.

The workaround is simple;

Identify and find the missing assemblies, which I did at:

C:\WINDOWS\Microsoft.NET\assembly\GAC_MSIL\System.Management.Automation\v4.0_3.0.0.0__31bf3856ad364e35\System.Management.Automation.dll
C:\WINDOWS\Microsoft.NET\assembly\GAC_MSIL\Microsoft.PowerShell.Commands.Utility\v4.0_3.0.0.0__31bf3856ad364e35\Microsoft.PowerShell.Commands.Utility.dll

And copy them to on all SMA Runbook Workers:

%windir%\System32\WindowsPowershell\v1.0

 

Below is the complete error message found in the Event Log on the SMA Runbook Worker:


Build started 2014-10-16 13:06:31.
__________________________________________________
Project "C:\Users\<SMARunbookWorkerAccount>\AppData\Local\Temp\PSWorkflowCompilation\Workflow_f8de811dc1ff4612b48fe9cc0c69d546\Project\RuntimeProject.csproj" (default targets):

Target GetReferenceAssemblyPaths:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets(983,5): warning MSB3644: The reference assemblies for framework ".NETFramework,Version=v4.5" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend.
Done building target "GetReferenceAssemblyPaths" in project "RuntimeProject.csproj".
Target PrepareForBuild:
Creating directory "bin\Release\".
Creating directory "obj\Release\".
Target ResolveAssemblyReferences:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3106: Assembly strong name "C:\Windows\System32\WindowsPowerShell\v1.0\Microsoft.PowerShell.Commands.Utility.dll" is either a path which could not be found or it is a full assembly name which is badly formed. If it is a full assembly name it may contain characters that need to be escaped with backslash(\). Those characters are Equals(=), Comma(,), Quote("), Apostrophe('), Backslash(\).
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3106: Assembly strong name "C:\Windows\System32\WindowsPowerShell\v1.0\System.Management.Automation.dll" is either a path which could not be found or it is a full assembly name which is badly formed. If it is a full assembly name it may contain characters that need to be escaped with backslash(\). Those characters are Equals(=), Comma(,), Quote("), Apostrophe('), Backslash(\).
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3106: Assembly strong name "C:\Windows\System32\WindowsPowerShell\v1.0\Microsoft.PowerShell.Commands.Utility.dll" is either a path which could not be found or it is a full assembly name which is badly formed. If it is a full assembly name it may contain characters that need to be escaped with backslash(\). Those characters are Equals(=), Comma(,), Quote("), Apostrophe('), Backslash(\).
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3106: Assembly strong name "C:\Windows\System32\WindowsPowerShell\v1.0\System.Management.Automation.dll" is either a path which could not be found or it is a full assembly name which is badly formed. If it is a full assembly name it may contain characters that need to be escaped with backslash(\). Those characters are Equals(=), Comma(,), Quote("), Apostrophe('), Backslash(\).
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3270: There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "mscorlib", "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3270: There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "System.Data", "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.
Done building target "ResolveAssemblyReferences" in project "RuntimeProject.csproj".
Target XamlMarkupCompilePass1:
C:\Users\<SMARunbookWorkerAccount>\AppData\Local\Temp\PSWorkflowCompilation\Workflow_f8de811dc1ff4612b48fe9cc0c69d546\Project\ho5coutk.gts.xaml : error XC1014: Assembly 'Microsoft.PowerShell.Commands.Utility, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' can not be resolved. Please add a reference to this assembly in the project that is being built.
C:\Users\<SMARunbookWorkerAccount>\AppData\Local\Temp\PSWorkflowCompilation\Workflow_f8de811dc1ff4612b48fe9cc0c69d546\Project\onhtvslm.qxx.xaml : error XC1014: Assembly 'Microsoft.PowerShell.Commands.Utility, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' can not be resolved. Please add a reference to this assembly in the project that is being built.
C:\Users\<SMARunbookWorkerAccount>\AppData\Local\Temp\PSWorkflowCompilation\Workflow_f8de811dc1ff4612b48fe9cc0c69d546\Project\rl5vmykt.eca.xaml : error XC1014: Assembly 'Microsoft.PowerShell.Commands.Utility, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' can not be resolved. Please add a reference to this assembly in the project that is being built.
Done building target "XamlMarkupCompilePass1" in project "RuntimeProject.csproj" -- FAILED.

Done building project "RuntimeProject.csproj" -- FAILED.

Build FAILED.

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets(983,5): warning MSB3644: The reference assemblies for framework ".NETFramework,Version=v4.5" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend.
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3106: Assembly strong name "C:\Windows\System32\WindowsPowerShell\v1.0\Microsoft.PowerShell.Commands.Utility.dll" is either a path which could not be found or it is a full assembly name which is badly formed. If it is a full assembly name it may contain characters that need to be escaped with backslash(\). Those characters are Equals(=), Comma(,), Quote("), Apostrophe('), Backslash(\).
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3106: Assembly strong name "C:\Windows\System32\WindowsPowerShell\v1.0\System.Management.Automation.dll" is either a path which could not be found or it is a full assembly name which is badly formed. If it is a full assembly name it may contain characters that need to be escaped with backslash(\). Those characters are Equals(=), Comma(,), Quote("), Apostrophe('), Backslash(\).
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3106: Assembly strong name "C:\Windows\System32\WindowsPowerShell\v1.0\Microsoft.PowerShell.Commands.Utility.dll" is either a path which could not be found or it is a full assembly name which is badly formed. If it is a full assembly name it may contain characters that need to be escaped with backslash(\). Those characters are Equals(=), Comma(,), Quote("), Apostrophe('), Backslash(\).
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3106: Assembly strong name "C:\Windows\System32\WindowsPowerShell\v1.0\System.Management.Automation.dll" is either a path which could not be found or it is a full assembly name which is badly formed. If it is a full assembly name it may contain characters that need to be escaped with backslash(\). Those characters are Equals(=), Comma(,), Quote("), Apostrophe('), Backslash(\).
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3270: There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "mscorlib", "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3270: There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "System.Data", "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.
C:\Users\<SMARunbookWorkerAccount>\AppData\Local\Temp\PSWorkflowCompilation\Workflow_f8de811dc1ff4612b48fe9cc0c69d546\Project\ho5coutk.gts.xaml : error XC1014: Assembly 'Microsoft.PowerShell.Commands.Utility, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' can not be resolved. Please add a reference to this assembly in the project that is being built.
C:\Users\<SMARunbookWorkerAccount>\AppData\Local\Temp\PSWorkflowCompilation\Workflow_f8de811dc1ff4612b48fe9cc0c69d546\Project\onhtvslm.qxx.xaml : error XC1014: Assembly 'Microsoft.PowerShell.Commands.Utility, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' can not be resolved. Please add a reference to this assembly in the project that is being built.
C:\Users\<SMARunbookWorkerAccount>\AppData\Local\Temp\PSWorkflowCompilation\Workflow_f8de811dc1ff4612b48fe9cc0c69d546\Project\rl5vmykt.eca.xaml : error XC1014: Assembly 'Microsoft.PowerShell.Commands.Utility, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' can not be resolved. Please add a reference to this assembly in the project that is being built.
7 Warning(s)
3 Error(s)

Time Elapsed 00:00:03.05
Advertisements

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