SCCM | Create user collections based on Active Directory department attribute with Powershell
We recently built a new Configuration Manager system for a client who wanted user collections for all departments and companies within their corporate group.
We were going to set these up manually which is a fairly simple, but time consuming, job to do. But this was a time restricted installation so we had a quick Google and found an awesome Powershell script written by Timmy Andersson over at CTGlobal which would create all the department collections we required.
Full instructions and all the Powershell scripts you would need to carry this out is available from here.
We used this script and it worked perfectly, especially as their AD was all up to date with department and company data and we had already setup the discovery for these attributes for other parts of reporting that they wanted.
We also then amended this script slightly to carry out company collection creations as well. This saved us a few days work and were able to hand over way before the deadline.