Microsoft KB Archive/933555

= Cannot retrieve advertised program categories by using a VBScript that includes the GetCategories function in Systems Management Server 2003 =

Article ID: 933555

Article Last Modified on 4/24/2007

-

APPLIES TO


 * Microsoft Systems Management Server 2003

-



SYMPTOMS
You create a Microsoft Visual Basic Scripting Edition script (VBScript) that uses the GetCategories function to obtain the program category information from advertised programs in Microsoft Systems Management Server (SMS) 2003. However, the GetCategories method fails.



CAUSE
This issue occurs because the SMS client Automation object (This object is the UIResource.UIResourceMgr Automation object.) that is used by the GetCategories function returns the information in a format that the VBScript script engine cannot interpret. The VBScript script engine only supports the indexing of SafeArrays of Variants.

Although VBScript can accept arrays of non-variant types for the purposes of boundary checking and to pass the arrays to other Automation objects, the VBScript script engine currently prohibits the manipulation of the array contents.



WORKAROUND
To work around this issue, you must use the GetCategories function from an environment where the array of BSTRs that is returned can be parsed correctly.

Applications and components that host VBScript Automation objects should create SafeArrays of Variants. Non-Variant data should be packaged in the Variant elements of the SafeArray to be returned to the VBScript script engine.

Scripts that are written in VBScript should also use the TypeName function to check the data type of a variable. The TypeName function returns the string Variant when it is passed an array of Variants.

