Rubix

View Original

How to Bulk Update Autopilot Group Tags

Well, I almost made it a full vacation without working. But hey- what can you do?

The other day, I received a question in the Discord server about what the easiest way would be to update enrollment profiles for Autopilot devices, specifically based on the group tag. The obvious answer is “change the group tag”. But how do we do that in bulk?

I wrote a quick PowerShell script using the Graph API to change group tags in bulk.

We start by authenticating to the graph via the WindowsAutopilotIntune module.

You’ll also need NuGet to install the module so we threw that in. Afterwards, use Connect-MgGraph to authenticate to your tenant (permissions will be required, of course.)

So now it’s time to re-tag. But how should we do this? I thought of two possible scenarios: the first, gathering a list of serial numbers for the devices that need to be updated. We can then import the list and use that to change tags.

That works.

But let’s say instead of individual devices, you’re looking for everything that has a certain group tag? Let’s call that the “old tag”. We can use the old tag to target those devices for tag changing.

There we go! The full code is now on my GitHub page here.

That’s all for now, but stay tuned for new videos coming this week, including another MVP guest!