A fellow Deployment Guy wanted to use some of the functions in ZTIDiskUtility.vbs in his own User Exit script. Since ZTIGather.wsf does not include ZTIDiskUtility.vbs in its <script> elements, these functions are not available during the MDT rules processing. One way to solve this would be to simply add a <script> element for ZTIDiskUtility.vbs into ZTIGather.wsf. But best practice dictates that you should only modify standard MDT scripts when it is absolutely necessary.
So how can you include a function library script like ZTIDiskUtility.vbs in such a way that it is available during rules processing without modifying the script itself to make it into a User Exit script? The way I solved this was to dig into ZTIGather.wsf to see how it was including User Exit scripts. This is done with a function appropriately called ProcessUserExit. I then copied this function into its own User Exit exit script (IncludeExit.vbs), changed the function name to Include, and stripped out the call of the UserExit function. By using this User Exit script, you can use the Include function in CustomSetting.ini rules or your own User Exit scripts to make a function library script’s functions available during rules processing. For example, by using the rules below all the functions and classes in ZTIDiskUtility.vbs become available for use in CustomSetting.ini rules or other User Exit scripts.
You can now use ZTIDiskUtility.vbs functions in rules. The example below shows how you can set a custom variable using such a function:
DiskSizeDisk0 = #GetDiskSize(0)#
This techniques can be used with other VBScript procedure library scripts.
This post was contributed by Michael Murgolo, a Senior Consultant with Microsoft Services – U.S. East Region