With every new version of ARS we are trying to get rid of VBS legacy by replacing these scripts with PS ones. Since we have same graphical interface for both scripting languages in ARS, there are some things which are not obvious for newbies and even experienced users without RTM. For example, we have button "Include Library Script", which allows us to select library script and include required code for VB script. But if we try to do the same trick with PS script it will not work. We can find out in ARS SDK that here we have to add onInit handler manually in order to use PS library script.
But what about Scheduled Task scripts? Scheduled tasks historically don't have any handlers. So, it looks like there is no easy way to include library scripts in PS code.
Quest support recommends us next workarounds for this problem (https://support.oneidentity.com/kb/71567):
WORKAROUNDCopy/Paste necessary pieces of library script directly to PS Script for scheduled task
WORKAROUND 2Use VBS instead of PowerShell
I didn't like both of these workarounds and tried to invent another oneJ. We will try to create external library module and then import it from our scheduled script.
I created following folders inside My Documents folder WindowsPowerShell/Modules/Library and saved my script there as Library.psm1. Now we can try to view the offerings of a module. In my case there is only one function.
After that we can include our library into PS Scheduled Task Script and test it.
when is this from?
Is this still not possible?
I have used invoke-expression to load the library from the property edsaScriptText.
$objScriptModule = [adsi]"EDMS://CN=Function Library,CN=Script Modules,CN=Configuration"
$libraryFunctionText = [string]($objScriptModule.edsaScriptText)
I would definitely like to see built in functionality for this in the future, I always stray away from loading modules from the server, it does work but you have to load and update them on every AR Service in your enterprise which can introduce a layer of complexity to your deployment.
Anyone Else found a workaround?