Hi SCCM Gurus,
I was in the issue of moving an advertisement to a subfolder and found a solution which a script does it perfectly. Now I can move an already available advertisement to a subfolder and immediately i can see the same in the subfolder.
While creating the advertisement, im using the same script code to move the created advertisement to the same subfolder, but unable to see the advertisement in any folder. Thru script code, i can find it and i can find the advertisement id also but not visually. Thru the same script i tried to find the location of the advertisement and it says, it resides in the subfolder where i have moved earlier. but i cant see that visually in that subfolder.
Note: Before finding the moving script also, i faced the same issue as the created advertisements are not visible as moving is failed.
Is there anyway to see the advertisements which are available (Accessible thru script) and not visible. May i know why this is behaving like this. Please help. The used script codes are attached here for your reference.
'To Move the Advertisement to an subfolder strAdvertName = inputbox("Enter the advertisement name") Set colAdverts = objSCCM.ExecQuery("Select * From SMS_Advertisement where AdvertisementName = '" & strAdvertName & "'") For Each advert In colAdverts strAdvertiseID = advert.AdvertisementID Next AdvertID(0) = strAdvertiseID Set AdvertisementInfo = objSCCM.ExecQuery ("select * from SMS_ObjectContainerNode where Name = '" & FolderName & "'") For Each objItem in AdvertisementInfo folderID = objItem.ContainerNodeID Next Set objAdvertFolder = objSCCM.Get("SMS_ObjectContainerItem") MoveAdvertisement = objAdvertFolder.MoveMembers (AdvertID, 0, folderID, "3")
'To Find the Advertisement ID which is not visible strAdvertName = inputbox("Enter the advertisement name") Set colAdverts = objSCCM.ExecQuery("Select * From SMS_Advertisement where AdvertisementName = '" & strAdvertName & "'") For Each advert In colAdverts strAdvertiseID = advert.AdvertisementID Next msgbox strAdvertiseID
'To find the folder where the invisible advertisement resides set ads = objSCCM.ExecQuery("SELECT ContainerNodeID FROM SMS_ObjectContainerItem WHERE InstanceKey = '" & AdvertID(0) & "' AND ObjectType = 3") for each itm in ads msgbox itm.ContainerNodeID next