Microsoft Knowledge Base Email Alertz

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

Search KbAlertz

Advanced Search

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]











Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks

Article ID: 933555 - Last Review: April 24, 2007 - Revision: 1.1

Cannot retrieve advertised program categories by using a VBScript that includes the GetCategories function in 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.

REFERENCES

For more information about script errors when referencing non-variant arrays, click the following article number to view the article in the Microsoft Knowledge Base:
165967  (http://kbalertz.com/Feedback.aspx?kbNumber=165967/ ) Script error occurs when referencing non-variant array

APPLIES TO
  • Microsoft Systems Management Server 2003
Keywords: 
kbtshoot kbprb kbexpertiseinter KB933555
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate