Loading Scripts that Have VBScript Classes or that Don’t Have a UserExit Function as User Exit Scripts – Script Update

In a previous post I provided a script that allows loading scripts that have VBScript Classes or that don’t have a UserExit function in them as User Exit scripts in CustomSetting.ini.  This script also allows you to load multiple User Exit scripts in a single CustomSetting.ini section as in this example:

[Settings]
Priority=IncludeExitScripts, Default
Properties=ExitScripts(*)

[IncludeExitScripts]
UserExit=MDTExitInclude.vbs
ExitScripts001=#Include("MDTLibHelperClasses.vbs")#
ExitScripts002=#Include("ModelAliasExit.vbs")#
ExitScripts003=#Include("MDTConfigMgrFunctions.vbs")#

I was recently using this again at another customer and had one of those “duh” moments.  Why didn’t I make the Include function just take a comma separated list of scripts instead of just one?  Then you wouldn’t need multiple lines to load multiple scripts.  So I added a new function to MDTExitInclude.vbs called IncludeFiles that accepts a list of scripts.  This function then calls Include once for each script in the list.  (I did it this way to maintain compatibility with the old method shown above.)  The section can then be simplified to this:

[Settings]
Priority=IncludeExitScripts, Default
Properties=ExitScripts

[IncludeExitScripts]
UserExit=MDTExitInclude.vbs
ExitScripts=#IncludeFiles("MDTLibHelperClasses.vbs,ModelAliasExit.vbs,MDTConfigMgrFunctions.vbs")#

The latest version of MDTExitInclude.vbs is attached below.

 

Disclaimer: The information on this site is provided "AS IS" with no warranties, confers no rights, and is not supported by the authors or Microsoft Corporation. Use of included script samples are subject to the terms specified in the Terms of Use .

This post was contributed by Michael Murgolo, a Senior Consultant with Microsoft Services - U.S. East Region.

MDTExitInclude.zip