PowershellComponentNet4 - ExecuteCommand -> No snap-ins have been registered for Windows PowerShell version 2.

We run IAM 9.1.1

Hi Community, I have a little problem firing a custom script.

We have a little PSM1 module written to update a role in Coupa via REST. Now we want to import that module and run the command to change the user role. Sadly, I´m to dumb to let this command run. From my understanding, I can choose PowershellComponentNet4 - ExecuteCommand and in the Parameters I can define:

  • The Command -> Add-RoleToUser
  • some of the parameters, including the Encrypted value for the ClientSecret
  • Snapins -> In our case the PowerShell module. 

But when I run the script, I got this error:

ErrorMessages	(2023-08-31 07:50:53.697) [System.Management.Automation.PSArgumentException] No snap-ins have been registered for Windows PowerShell version 2.
   at StdioProcessor.StdioProcessor._Execute(Job job)
   at VI.Jobservice.JobComponents.PowershellComponentNet4.Activate(String task)
   at VI.Jobservice.JobComponents.PoshBaseTask.Execute()
   at VI.Jobservice.JobComponents.Utils.CreateCommands(JobParameters parameters, IPoshRunner runner)
   at VI.Jobservice.JobComponents.Utils.AddParameters(Command target, IDictionary`2 parametersToSet, IPoshRunner context)
   at VI.Base.PowerShell.Commands.CommandHelper.GetCommandParameters(String command, IPoshRunner runner)
   at VI.Base.PowerShell.Runner.NonInterActiveLocalPoshRunner.Execute(IPoshExecutionItem execItem)
   at VI.Base.PowerShell.Runner.NonInterActiveLocalPoshRunner.InitRunspace()
   at System.Management.Automation.Runspaces.InitialSessionState.ImportPSSnapIn(String name, PSSnapInException& warning)
   at System.Management.Automation.PSSnapInReader.Read(String psVersion, String mshsnapinId)
   at System.Management.Automation.PSSnapInReader.GetMshSnapinRootKey(RegistryKey versionRootKey, String psVersion)

EDIT: Yes, Im too dumb :) ITs not a SnapIn so the error makes totally sense. However, the following Question remains:

I would try the ExecuteScript but I have no Idea how I can decrypt the ClientSecret without do it in the step before to avoid the clear text value of it in any logfile.

Any Idea?

Best, Denny