SCCM User Collections by Job Title, etc.

For some of you this is going to be a no-brainer, but for some reason I’ve been getting more and more questions about how to make User Collections in SCCM based on query rules using AD account properties, like:

  • Job Title
  • Department Name
  • Division
  • City
  • Description

While it’s still fine to use other criteria for Collection membership rules, such as OU path, Security Group names, and so on, it’s always nice to know you have even more options available.

For one customer, they found it unnecessary to add people to security groups when they already have a consistently maintained job “title” for each user account in Active Directory.  When they want to deploy software to employees by their title, why not do that directly, instead of populating a group and adding more work?  In some cases, a group is necessary for other purposes, so it’s a fact of life.  But for this customer, and others like them, they don’t rely on security groups for targeting configuration rules or software deployments.

Best of all, this is really easy (I mean REALLY, REALLY, REEEEEEEEAAALLY easy) to do.

Step 1 – Adjust the Discovery Settings

By default, SCCM collects a fairly good subset of AD account attributes for user and computer objects in a given AD forest/domain.

  • name
  • distinguishedName
  • dnsHostName
  • mail
  • objectGUID
  • objectSID
  • primaryGroupID
  • sAMAccountName
  • userAccountControl
  • userPrincipalName
  • whenCreated

The best thing about SCCM is that it’s flexible.  You can select other attributes to gather from the environment during each discovery cycle.  Just be aware that when you change Discovery settings, it does have some impact on the environment, even if negligible.

For example, when you add more settings to collect, such as discovery information, hardware and software inventory, it means more data being transmitted across the network, and more data being stored in the SCCM SQL database tables.  The impact of a discovery rule change is typically short-lived.  From then on, only delta changes are collected, and network overhead is back to minimal.

For this example, lets add some attributes for User discovery:

  1. In the SCCM admin console, select Administration, and then expand Hierarchy Configuration / Discovery Methods.
  2. Open “Active Directory User Discovery” (or right-click / Properties)
  3. Select the “Active Directory Attributes” tab
  4. Press CTRL and select “department“, “division“, “employeeID” and “title“, then click “Add >>” to move them into the Selected Attributes list.
  5. Click OK

sccm1.png

At this point, you can wait for the next Discovery cycle to run, or force it (get your fully-charged snake prod ready, for when the Network folks come storming in to yell at you for a small spike in network traffic, “caused by your evil SCCM tool thing!!”)  Just kidding.  If they freak over this small blip, offer them some marijuana-infused cookies.  Works every time.

Step 2 – Create a Collection

  1. Select Assets and Compliance
  2. Select User Collections (if you have folders beneath this, expand the appropriate folder, or create a new folder, whatever floats your boat)
  3. Create a new User Collection (right-click or select from ribbon menu)
  4. For this example, I’m going to make a User Collection to identify Sales Managers, because they’re fun to mess with.  We can deploy all sorts of painful things to them as reward for the joy they bestow upon their technical brethren.  So I will name this “Users – Title – Sales Managers”
  5. For Limiting Collection, you can use “All Users”, and click Next
  6. On the Membership Rules panel, check both “Use incremental updates for this collection” and “Schedule a full update on this collection”, because the query-based membership could change as Sales Managers are assassinated by angry coworkers and replaced by more of them stamped from the assembly line.  Just kidding.  But still, check both options.
  7. Click “Add Rule” / “Query Rule
  8. Name the rule “1” (that’s right, a number one.  For the rank of those who annoy us most)
  9. Click “Edit Query Statement…”
    sccm2
    sccm3
  10. On the General tab, check the option “Omit duplicate rows (select distinct)” (which should be selected by default, but whatever, I’m too lazy to upload this tiny request to User Voice).
  11. Select the “Criteria” tab.
  12. Click the weird little asterisk button (new query)
    sccm4.png
  13. On the Criterion Properties form, click “Select”.  On the Select Attribute popup, select Attribute Class “User Resource”, and select Attribute “title”.  Then click OK.
    sccm5
  14. Back on the Criterion Properties form, below the Value box, select the Value… button and choose the title you wish to filter on, such as (equal to) “Sales Manager” or (is like) “Sales%”
  15. Click OK and OK again to complete the process of creating the new Collection.

Now, you (hopefully) have a collection of users with a specific job title (or department, division, location value, employeeID sequence, etc.) which can be used to drive reports, and target software deployments.

Caveats

Because everything in life comes with conditions, this does as well.  First off, it depends on a properly-managed and maintained Active Directory environment.  Whether that is the result of manual effort, scripting, or third-party applications, it doesn’t matter as long as the data is reliable enough to based queries on.  If the data exists in AD, and SCCM discovery can find it, you can leverage it for almost anything.

How to Unintentionally Reimage Every Computer in your Company using SCCM

airplane

Step 1 – Be a complete Idiot

Step 2 – Do not do any research or seek training of any kind.  In fact, ignore every bit of advice, guidance, or recommendation by any experienced human being

Step 3 – Enable IP Helpers on every Router – or – place every computer in the same IP subnet as the PXE-enabled DP server

Step 4 – Do not use a password on any of your Task Sequences

Step 5 – Deploy the Task Sequence to the All Systems collection and set the Deployment availability to Required *AND* set “Configuration Manager Clients, media and PXE”

Step 6 – Make sure EVERY machine is set to boot from the Network by default

Step 7 – Reboot EVERY computer

Step 8 – Press F12 on EVERY computer as it reboots (after contacting the PXE host of course)

Step 9 – Tell everyone you know that SCCM “accidentally” reimaged all your computers

Step 10 – Run for public office, where these skills are valued most

 

5 SCCM Myth Corrections

In keeping with the popular (and completely stupid) trend of “5 this…” and “10 that…” memes…

ta-puke

Myth 1 – Discovery Settings

Contrary to what you may hear (I hear it a lot, unfortunately) SCCM discovery settings do not modify the computers in your environment.  They simply allow SCCM to shine a flashlight on what’s in the environment.  Think of it like a restaurant menu.  The waiter hands it to you to look over and see what you’d like.  SCCM is the waiter. It’s not cooking anything until you place your order.  Discovery doesn’t install anything, or modify configuration settings, restart, etc.  The only situation when it could make changes to discovered computers would be having automatic client push installation enabled (in most cases you shouldn’t)

Myth 2 – Script Wrapping is not “Packaging”

“Packaging”, technically, is the process of creating the ORIGINAL installation payload (.exe, .msi, .whatever).  When you create a new package from an existing package, that’s technically called “repackaging”.  Executing a package with additional (optional) command line switches is simply called “using the package”.  Putting the package and switches into a script file is called “script wrapping”.  Entering the package name, with optional switches, into the SCCM console is called “doing your job”.

Myth 3 – “Packaging” is NOT “Repackaging”

When Microsoft builds the setup.exe for something like Office or Visual Studio Code, that’s called “Packaging”.  When you take that package, initiate a snapshot monitoring session on a reference computer using Flexera AdminStudio Repackager*, run the package installer, make some system changes, add stuff, remove stuff, laugh at stuff, yell at stuff, capture the changes, create a project, clean it up, bitch and moan a lot, drink some coffee, crank out the package solution, compile that into an .MSI or .EXE, copy it over to another folder location, go outside and scream the anger and frustration out of your soul, throw your cold, empty coffee up at the nearest hard surface, then THAT is called “repackaging”.

Real, honest, true, repackaging sucks.  It’s not a fun job.  It’s like rebuilding a transmission to a typical auto mechanic, or removing impacted feces from a cow for a veterinarian.  Un-fun.  Last resort.  The kind of thing that makes you internalize a lot of anger and frustration at how the situation COULD have been avoided, had someone taken the time to do something differently at an earlier stage.  But NOooooooooo… it then becomes YOUR problem to deal with.  Anyhow, hourly billing offers some solace.

Myth 4 – SCCM will NOT automatically reimage all your computers just because you enable PXE with OSD

I’m not even going to waste time on this one.  If you don’t believe me, you’re an idiot, but don’t be offended.  Lots of people are idiots.  Most of them write blogs like this one.  Hey, wait a minute!?

Myth 5 – MDT and SCCM Can coexist.  SCCM and WSUS can coexist

I don’t know where it started, or who started it, but whoever said SCCM cannot coexist in the same environment with separate instances of MDT or WSUS was wrong.  It can.  It does.  In some cases, it’s even recommended.  Like anything else in IT, it comes down to having a solid technical and business case for doing it.

Cheers