Hi All,
im have been doing some vb-scripting of sccm for a while and came across an interesting issue.
According to MS http://msdn.microsof...y/cc143262.aspx one must create both the collection as well as the corresponding SMS_CollectToSubcollect object:
' Create the collection.
Set newCollection = connection.Get("SMS_Collection").SpawnInstance_
newCollection.Comment = newCollectionComment
newCollection.Name = newCollectionName
newCollection.OwnedByThisSite = ownedByThisSite
' Save the new collection and the collection path for later.
Set collectionPath = newCollection.Put_
' Define to what collection the new collection is subordinate.
' IMPORTANT: If you do not specify the relationship, the new collection will not be visible in the console.
Set newSubCollectToSubCollect = connection.Get("SMS_CollectToSubCollect").SpawnInstance_
newSubCollectToSubCollect.parentCollectionID = existingParentCollectionID
newSubCollectToSubCollect.subCollectionID = CStr(collectionPath.Keys("CollectionID"))
' Save the subcollection information.
newSubCollectToSubCollect.Put_
Accidentally it comes to an error (general failure) in the line "newSubCollectToSubCollect.Put_"
Because of that collection is not shown in the console and I had to adjust the DB directly in order to get it shown.
I have a feeling, that it happens because the creation process has not been completed yet when the second Put_ call comes.
And the questions
1. Have your ever seen such a behaviour?
2. Would the change to AsyncPut_ resolve the problem?
Thanks in advance.