Adding Removing OUs to Azure AD Connect via PowerShell

I wanted to update the OUs synced from some of my connectors in Azure AD. It’s easy to do it via the GUI but there was nothing online on how to do it via PowerShell.

I asked ChatGPT and it hallucinated the hell out by making new cmdlets. :)




Amazing, the confidence with which is can make up non existent cmdlets. 😃

Anyways, inspired by this blog post I went around exploring every cmdlet in the module to see which one might do the trick. And finally stumbled upon this:

Then do a full sync so the OU is imported.

And to remove:

Didn’t realize the Add-ADSyncConnector can both add or update. While Googling more on that cmdlet I also came across this blog post – linking it here in case it’s of use to me later.