Using "library scripts” inside ARS PowerShell Scheduled Tasks scripts

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 (


Copy/Paste necessary pieces of library script directly to PS Script for scheduled task

Use 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.