Automating Creation of SCCM Collections

Recently we worked on a project where System Center Configuration Manager (SCCM) software deployments target collections of Active Directory (AD) Users and Groups instead of computer systems.  The client already had automated processes and workflows to facilitate the delivery of applications.

One process relied on a web interface to choose an AD group to be targeted for a particular application.  The customer requested a script that could be called from the Web application in a way that the AD group name could be passed as an argument, and the script would automatically create the collection with two dynamic queries: one relying on the User table and one on the UserGroup table to populate the collection with the members of the group and with the group itself.  In addition, another parameter would be passed that indicated if the collection should be created under the Licensed parent collection or under the Non-Licensed parent collection.  One last request was that if the AD group name started with “XX “ then strip that out, and if it started with “YYY “ then strip that out before using it as the collection name.

The script was developed.  To use it, the SCCM administrator must set the following variables at the beginning of the script:

  1. The collection ID for the parent Licensed collection
  2. The collection ID for the parent Non-licensed collection
  3. The name of the SCCM site server where the collection will be created

The script takes two arguments.  The first argument is the AD group name wrapped in double quotes (as it may contain spaces).  The second argument identifies the license type.  If “None” is passed then it is considered a non-licensed application; any other value indicates a licensed application.  This determines if the collection gets created as a child of the Licensed or Non-Licensed parent collection.

In line number 46, the NetBIOS domain name is added at the start of the value stored in the strColName variable (which is the name of the AD group).  In this case the domain name is “DOMAIN” followed by two backslashes (one extra backslash to account for the escape sequence).  This name can be modified depending on the domain name that the AD group belongs to.

Syntax example to call the script:

Cscript.exe CreateCol.vbs “My Group Name” Licensed

Share:

Facebook
Twitter
LinkedIn
Picture of Matt Tinney

Matt Tinney

Professional IT executive & business leader having decades of experience with Microsoft technologies delivering modern-day cloud & security solutions.

Contact Us

=
On Key

More Posts

WME Cybersecurity Briefings No. 020
Cyber Security

WME Security Briefing 26 July 2024

Pro-Houthi Group Targets Yemen Aid Organizations with Android Spyware Overview A suspected pro-Houthi group, OilAlpha, is targeting humanitarian organizations in Yemen with advanced Android spyware. The operation is associated with the activity cluster codenamed OilAlpha. It

Read More »
WME Cybersecurity Briefings No. 019
Cyber Security

WME Security Briefing 23 July 2024

Samba File Shares Targeted by DarkGate Malware in Recent Cyber Offensive Overview Recent investigations by Palo Alto Networks uncover a brief but significant cyberattack campaign utilizing DarkGate malware. This malicious software exploited Samba file shares to

Read More »
WME Cybersecurity Briefings No. 018
Cyber Security

WME Security Briefing 15 July 2024

OVHcloud Mitigates Record-Breaking 840 Million PPS DDoS Attack Overview In April 2024, OVHcloud, a top French cloud computing firm, successfully stopped a massive DDoS attack. The attack hit a record-breaking rate of 840 million packets per second

Read More »
E-Commerce Security - Solutions for Online Retailers
Azure

E-commerce Security – Solutions for Online Retailers

Today’s hyper-charged e-commerce landscape demands top-notch cybersecurity measures. Cybersecurity for this bustling sector isn’t just about ticking a technical box; it’s the cornerstone of building trust. As businesses and consumers flock to the online space, the

Read More »
Be assured of everything

Get WME Services

Stay ahead of the competition with our Professional IT offerings.

=