Executing PowerShell Script Performance

Has anyone noticed before that calling a PS script from a Run .NET activity takes a long time?

The logic below inside the Run .NET activity takes 15-16seconds.

$Script = “C:\test.ps1”

.$Script
UpdateTasks($Tasks)

Whenever you load a script into the .Net framework, there will be some overhead as it creates a new instance for that script to run in and then reads the file. If performance is an issue, perhaps you can convert it to a module and preload it into your environment. If you are loading the script multiple times in the same script, perhaps you could consider using a workflow script.

Thank you for your response. My problem is that in reality, the script that I’m calling is determined during runtime, users supply the filepath of the file that we need to execute.