Remove organization wide team users using PowerShell

%3CLINGO-SUB%20id%3D%22lingo-sub-1583225%22%20slang%3D%22en-US%22%3ERemove%20organization%20wide%20team%20users%20using%20PowerShell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1583225%22%20slang%3D%22en-US%22%3E%3CP%3ECan%20PowerShell%20be%20used%20to%20remove%20a%20team%20user%20from%20Organization%20wide%20team%20e.g.%26nbsp%3B%3CSPAN%3ERemove-TeamUser%3F%20Has%20anyone%20tried%20that%3F%20Does%20the%20change%20stick%20i.e.%20is%20the%20removed%20user%20re-added%20back%20by%20teams%20again%3F%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EI%20know%20recommended%20way%20to%20remove%20a%20user%20from%20Organisation%20wide%20team%20is%20to%20do%20it%20from%20the%20Teams%20client%20itself.%20But%2C%20our%20org-wide%20team%20has%20over%20100%20service%20accounts%20which%20we%20would%20like%20to%20remove%20via%20script.%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1583225%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EMicrosoft%20Teams%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EOrg-wide%20Team%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1583417%22%20slang%3D%22en-US%22%3ERe%3A%20Remove%20organization%20wide%20team%20users%20using%20PowerShell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1583417%22%20slang%3D%22en-US%22%3ERemove-TeamUser%20Should%20technically%20be%20the%20same%20thing.%20But%20I%E2%80%99ve%20Seen%20discrepancies.%20Go%20give%20one%20a%20whirl%20and%20see%20what%20happens%20%3Ap.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1585432%22%20slang%3D%22en-US%22%3ERe%3A%20Remove%20organization%20wide%20team%20users%20using%20PowerShell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1585432%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F869%22%20target%3D%22_blank%22%3E%40Chris%20Webb%3C%2FA%3ENope...Tried%20Remove-TeamUser%20and%20it%20doesn't%20stick.%20Teams%20just%20re-adds%20them%20back.%20It%20appears%20there%20is%20no%20way%20to%20do%20that%20via%20script%20and%20users%20must%20have%20to%20be%20removed%20using%20the%20Teams%20client%20for%20them%20to%20stay%20removed.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1585436%22%20slang%3D%22en-US%22%3ERe%3A%20Remove%20organization%20wide%20team%20users%20using%20PowerShell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1585436%22%20slang%3D%22en-US%22%3EThat's%20annoying.%20%3Ap.%3C%2FLINGO-BODY%3E
Highlighted
Frequent Contributor

Can PowerShell be used to remove a team user from Organization wide team e.g. Remove-TeamUser? Has anyone tried that? Does the change stick i.e. is the removed user re-added back by teams again?

 

I know recommended way to remove a user from Organisation wide team is to do it from the Teams client itself. But, our org-wide team has over 100 service accounts which we would like to remove via script.

3 Replies
Highlighted
Remove-TeamUser Should technically be the same thing. But I’ve Seen discrepancies. Go give one a whirl and see what happens :p.
Highlighted

@Chris WebbNope...Tried Remove-TeamUser and it doesn't stick. Teams just re-adds them back. It appears there is no way to do that via script and users must have to be removed using the Teams client for them to stay removed.

Highlighted
That's annoying. :p.