For integration into SCSM, SMLets is great and can be downloaded from the following location: https://smlets.codeplex.com/

Using in System Center Orchestrator really enhances the automation ability of SCSM, mixed with the integration pack.

There are some really good guides on getting this working:

However, once you think all the configuration is complete and you are working in PowerShell:

So, you then repeat the same in a Runbook:

And…… arrggghhhh:

The detail being:

Cannot load Windows PowerShell snap-in C:\Program files\Common Files\SMLets\SMLets.Module.dll because of the following error: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.

Loader Exceptions:

Could not load file or assembly ‘Microsoft.EnterpriseManagement.Core, Version=7.0.5000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified.

Could not load file or assembly ‘Microsoft.EnterpriseManagement.Core, Version=7.0.5000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified.

Could not load file or assembly ‘Microsoft.EnterpriseManagement.Core, Version=7.0.5000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified.

So, the issue is my case; is that the version of the DLLs copied into the c:\windows\assembly folder and then registered are actually the SDK files from the SCORCH 2016 installation, which can only use PowerShell V3:

The ones from a 2012 r2 version, which support PowerShell V2 aka default to Orchestrator; are as follows:

Solution

So, there are two options:

  1. Copy the old files into Assembly and register
  2. Make a registry change to allow Orchestrator play with later PowerShell versions

Option 1 – Replace the files:

Okay I know you want the registry…. but wait:

  1. Unregister the 2016 R2 DLLs
  2. Copy the new (or old as the case may be) files into the c:\windows\assembly
  3. Register the new / old files

Completed by PowerShell:

.‘C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\gacutil.exe’
-u
Microsoft.EnterpriseManagement.Core

.‘C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\gacutil.exe’
-u
Microsoft.EnterpriseManagement.ServiceManager

copy
D:\nobackup\2012R2\*
C:\Windows\assembly

.‘C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\gacutil.exe’
-i
C:\Windows\assembly\Microsoft.EnterpriseManagement.Core.dll

.‘C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\gacutil.exe’
-i
C:\Windows\assembly\Microsoft.EnterpriseManagement.ServiceManager.dll

 

Option 2 – Registry change

 

Yes, indeed; a single registry change will allow Orchestrator to unleash later PowerShell; thanks’ go to the following post:

It is a simple reg fragment to tell 32Bit to use the latest version as follows:

  • Open regedit edit and goto location: [HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\.NETFramework]
  • Create a new DWORD with the name: OnlyUseLatestCLR with a decimal value of 1

Voila! That is it…. No reboot, just give it a whirl. I try the same runbook test, without even coming out of it: