• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Clatent

Technology | Fitness | Food

  • About
  • Resources
  • Contact

Getting Started with 365AutomatedLab Part 2

October 6, 2023 by ClaytonT Leave a Comment

Adding/Removing Groups

Adding and removing groups with 365AutomatedLab is as easy as it is for adding and removing users(If you missed part one, check out Getting Started with 365AutomatedLab Part 1) It can add and remove the 4 different groups(Group, Mail Enabled Security, Distribution, and Security) that 365 has from one excel sheet. As of right now it will fill in the Display Name, Primary SMTP, and Description. I’ll be adding more parameters, but wanted to get at least these available. What are some other parameters you want to see first?

Adding Groups

Now the fun part, adding groups with one line of code. But, first we need to have a worksheet named “Groups” with the column headers

  • DisplayName
  • PrimarySMTP
  • Description
  • Type

After you have created those, you can input the data that you want in those fields. Remember for type you will use 365Group, 365MailEnabledSecurity, 365Distribution, or 365Security, which will tell 365 what type of group you want created. If you don’t have test data feel free to go to the already premade Excel workbook in the LabSources section in the repository. Below is a quick snapshot of the Excel workbook.

Data all set? Let’s run this little One-Liner to import all these groups into 365!

New-CT365Group -FilePath C:\\Scripts\\LabSources\\365DataEnvironment3.xlsx -UserPrincipalName admin@yourdomainname.onmicrosoft.com -Domain yourdomainname.onmicrosoft.com

Depending on when you last logged in, you’ll have to confirm access twice, once for Exchange Online and once for Graph. If you don’t allow these, the script will look like it froze on you. Trying to save you some of the headaches that I went through!

Your 365 Portal should now look like this

All set! That’s really how easy it is!

Removing Groups

The beauty of this setup, is now you only have to one PowerShell command, and you are all set.

Remove-CT365Group -FilePath C:\\Scripts\\LabSources\\365DataEnvironment3.xlsx -UserPrincipalName admin@yourdomainname.onmicrosoft.com

All done, now all your groups in your Excel workbook are removed!

Summary

Wasn’t it easy? Testing larger data sets will be a breeze or setting up and removing tests. You should never have to test in a production environment, as you can copy those groups to the Excel workbook and import them into your Dev tenant. I hope you found this helpful and makes your life easier as it has mine. If you have any recommendations or questions, please feel free to reach out and/or create a Github Issue.

GitHub: 365AutomatedLab

Share this:

  • Share on X (Opens in new window) X
  • Share on Facebook (Opens in new window) Facebook
  • Email a link to a friend (Opens in new window) Email
  • Share on LinkedIn (Opens in new window) LinkedIn
  • Share on Reddit (Opens in new window) Reddit

Like this:

Like Loading...

Related

Tagged With: 365, 365AutomatedLab, Automation, AzureAD, Entra, Excel, PowerShell

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recipe Rating




Primary Sidebar

Clayton Tyger

Tech enthusiast dad who has lost 100lbs and now sometimes has crazy running/biking ideas. Read More…

Find Me On

  • Email
  • GitHub
  • Instagram
  • LinkedIn
  • Twitter

Recent Posts

  • Did you know there is a Giphy rating in Teams? Custom Maester Tests save the day
  • Learning ValidateSet in PowerShell: Valid Values Only
  • Teams Chat and PowerShell – How to add value!
  • EntraFIDOFinder: New Web UI and Over 70 New Authenticators
  • January 19, 2026 Updates to EntraFIDOFinder

Categories

  • 365
  • Active Directory
  • AI
  • AzureAD
  • BlueSky
  • Cim
  • Dashboards
  • Documentation
  • Entra
  • Get-WMI
  • Learning
  • Module Monday
  • Nutanix
  • One Liner Wednesday
  • Passwords
  • PDF
  • Planner
  • PowerShell
  • Read-Only Friday
  • Reporting
  • Security
  • Uncategorized
  • Windows
  • WSUS

© 2026 Clatent

%d