Powershell Call Function

avatar

Greetings,

I added two RDM PowerShell scripts entry named SCRIPT_A and SCRIPT_B.
In SCRIPT_A, I added a function called MyFunction1 with parameters $param1 and $param2.

function MyFunction1($param1, $param2)
{
[do some operation here]
}

How can I call MyFunction1 from SCRIPT_B?

Until now, I saved the function in a file named myscript.ps1 and called it from SCRIPT_B.
However, I now want to import all my PS1 script libraries as RDM entries.

Is there a method to accomplish this?

Thank you.

All Comments (3)

avatar

Hello,

Which version of RDM are you using ?

Have you downloaded the RDM PowerShell Module ?

Are you using Powershell 7 ?

Best regards,

avatar

Hi Zachary,

Which version of RDM are you using ? The latest version
Have you downloaded the RDM PowerShell Module ? Yes
Are you using Powershell 7 ? Yes

Best Regards,

avatar

Hello,

With the Devolutions.PowerShell module, you can decrypt the information of an embedded script, please refer to https://forum.devolutions.net/topics/31591/setting-the-embedded-script-in-a-powershell-session#127176

This would allow you to import the function after for your other script.

Best regards,

Richard Boisvert