Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

COM+ Construction strings

Status
Not open for further replies.

sfriday

IS-IT--Management
Feb 23, 2002
211
DE
I am trying to add construction strings to a component, I ahve managed to get as far as locating the component, however the next step is proving a little tricky.

All examples I have seen use VB and NOT VBscript, my problem is the follwoing line of code

DIM varname AS COMAdminCatalogObject

How can I do this in VBscript, I need to get to the objects to set the constructor strings, if the above line was to work then I could do

varname.value("ConstructorString") = "Provider=MSADORA"
varname.SaveChanges

example below, I have converted to VBscript it is only the last Dim statement that I am having problems with.

:
Dim objCatalog As COMAdmin.COMAdminCatalog
Set objCatalog = CreateObject("COMAdmin.COMAdminCatalog")
Dim objTopCollection As COMAdmin.COMAdminCatalogCollection
Set objTopCollection = objCatalog.GetCollection("TopCollection")
objTopCollection.Populate
Dim objItem As COMAdmin.COMAdminCatalogObject
For Each objItem in objTopCollection
If objItem.Name = "ItemName" Then
objItem.Value("PropertyName") = NewPropValue
Exit For
End If
Next
objAppCollection.SaveChanges

Any help appreciated
Regards
Steve Friday
 
Hi,

Instead of using For-Each try this:

Dim catalog
Dim collection
Dim item
Dim sStr


'Equivalent of newline
NewLine = Chr(13) + Chr(10)

sStr = InputBox("Enter a top-level collection:")

'Navigate the COM+ Catalog
set catalog = CreateObject("COMAdmin.COMAdminCatalog")
set collection=catalog.GetCollection(sStr)
collection.Populate()
num = collection.Count

'Header
output = "Installed COM+ Applications" & Newline & "=========="
WScript.Echo output

'View Collection
For I = num - 1 to 0 step -1
set item = collection.Item(I)
output = item.Name
WScript.Echo output
Next

output = NewLine & NewLine
WScript.Echo output

set catalog=Nothing
set collection=Nothing
set item=Nothing

----------------------------

Regards,
Peter
 
Thanks for that, will test and let you know
Regards
Steve Friday
 
Nice try but unfortunatley it gets me to the same point as the example I posted.

I can read the components IE

Applications is the top level
Steves components is the second level
master component is the third level

I have used your code and added in some extra IF's as I have to get the collections of each of the above listed components. Once I get to the master component I need to get the objects of the collection which they are varname.Value("ConstructorEnabled") and varname.value("ConstructionString") and this is where I am falling down as I can not find a way of getting the objects, The DIM statement shown in the original post is used with VB and exposes the objects of a collection so I need to know how to do the same in VBscript.


Regards
Steve Friday
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top