You could also do with PowerShell, something like this:

$SiteCode = ‘XXX’
$FolderName = 'Test'
$ConfigMgrModule = ‘D:\Program Files\Microsoft Configuration 
Manager\AdminConsole\bin\ConfigurationManager.psd1’

Import-module $ConfigMgrModule
set-location ${SiteCode}:

$FolderObj = Get-WmiObject -Class SMS_ObjectContainerNode -Namespace 
Root\SMS\Site_$SiteCode | Where-Object {$_.Name -like $FolderName}
Get-WmiObject -Class SMS_ObjectContainerItem -Namespace Root\SMS\Site_$SiteCode 
| Where-Object {$_.ContainerNodeID -eq $FolderObj.ContainerNodeID} | 
ForEach-Object {
    Get-CMDeviceCollection -CollectionID $_.InstanceKey | format-wide Name
}

-Phil

_________________________________________________________________
Phil Schwan | Technical Architect, Enterprise Windows Services
Project Leadership Associates | 2000 Town Center, Suite 1900, Southfield, MI 
48075
Lync: 312.756.1626  Mobile: 419.262.5133
www.projectleadership.net<http://www.projectleadership.net/>
[Description: Description: Description: Arrow email]Lead with Strategy. 
Leverage Technology. Deliver Results.
[linkedin_logo-19x20]<http://www.linkedin.com/in/philschwan>[Twitter-Logo1-20x20]<https://twitter.com/philschwan>
 [wordpress-logo3] <http://myitforum.com/myitforumwp/author/philschwan>



From: listsad...@lists.myitforum.com [mailto:listsad...@lists.myitforum.com] On 
Behalf Of Kehl, Reto
Sent: Friday, March 21, 2014 6:46 AM
To: mssms@lists.myitforum.com
Subject: RE: [mssms] vbscript to list collections in a folder of the configmgr 
2012 console

Thank you David, I think I got it

1) get ContainerNodeID for the folder being searched:  "Select * from 
SMS_ObjectContainerNode Where Name = '" & FolderName & "' And ObjectType = 5000"
2) get CollectionID for this ContainerNodeID: "Select * from 
SMS_ObjectContainerItem Where ContainerNodeID = '" & CollectionID & "'"

From: listsad...@lists.myitforum.com<mailto:listsad...@lists.myitforum.com> 
[mailto:listsad...@lists.myitforum.com] On Behalf Of David O'Brien
Sent: Freitag, 21. März 2014 10:39
To: mssms@lists.myitforum.com<mailto:mssms@lists.myitforum.com>
Subject: RE: [mssms] vbscript to list collections in a folder of the configmgr 
2012 console

Not at hand, cause my lab is still in transit from Germany to Australia.

The wmi classes you need to look at are sms_collection with 
sms_objectcontaineritem to look for the collection as an item inside a 
folder/container and then sms_objectcontainernode for the folder itself.
Easy peasy if you can check the classes in your environment.

hope that helps!

Sent from my Windows Phone
________________________________
From: Kehl, Reto
Sent: 21/03/2014 8:14 PM
To: mssms@lists.myitforum.com<mailto:mssms@lists.myitforum.com>
Subject: [mssms] vbscript to list collections in a folder of the configmgr 2012 
console

anyone have such a script?

Need to enumerate all collections in a folder.



Thanks,

Reto


--
This e-mail message and any attachments are of a confidential nature. The 
information is intended for the named addressee exclusively. If you are not the 
addressee, you may not electronically disseminate, otherwise distribute or copy 
this e-mail message, and you may also not use it for any purpose. Please notify 
the sender immediately if you have received this e-mail message by mistake, and 
delete this e-mail message and its attachments.

E-mail transmissions could be lost, intercepted, corrupted or destroyed. They 
could arrive late or incomplete, or could even contain viruses. Confidentiality 
and reliability of the information so transmitted cannot be guaranteed. 
Rothschild Bank therefore does not accept any liability or responsibility for 
errors or omissions regarding the information transmitted through e-mail.

If verification of the information transmitted through e-mail is required, 
please ask for postal delivery by contacting Rothschild Bank.

This e-mail message is provided for information purposes only. It should not be 
construed as an offer or solicitation to buy or sell any financial instruments 
or services. It is not to be made available to US persons and is not to be 
circulated within the USA.



--
This e-mail message and any attachments are of a confidential nature. The 
information is intended for the named addressee exclusively. If you are not the 
addressee, you may not electronically disseminate, otherwise distribute or copy 
this e-mail message, and you may also not use it for any purpose. Please notify 
the sender immediately if you have received this e-mail message by mistake, and 
delete this e-mail message and its attachments.

E-mail transmissions could be lost, intercepted, corrupted or destroyed. They 
could arrive late or incomplete, or could even contain viruses. Confidentiality 
and reliability of the information so transmitted cannot be guaranteed. 
Rothschild Bank therefore does not accept any liability or responsibility for 
errors or omissions regarding the information transmitted through e-mail.

If verification of the information transmitted through e-mail is required, 
please ask for postal delivery by contacting Rothschild Bank.

This e-mail message is provided for information purposes only. It should not be 
construed as an offer or solicitation to buy or sell any financial instruments 
or services. It is not to be made available to US persons and is not to be 
circulated within the USA.


________________________________

PRIVILEGED AND CONFIDENTIAL. This email and any files transmitted with it are 
privileged and confidential and intended solely for the use of the individual 
or entity to whom they are addressed. If you have received this email in error 
please notify the sender. If you are not the named addressee you should not 
disseminate, distribute or copy this e-mail or any of its attachments.


<<inline: image001.jpg>>

<<inline: image002.jpg>>

<<inline: image003.jpg>>

<<inline: image004.jpg>>

Reply via email to