Skip to content

WMI general failure (while creating subcollection)

Featured Replies

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.