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

Clatent

Technology | Fitness | Food

  • About
  • Resources
  • Contact

365

365AutomatedLab Update: Now Supports MacOS

October 23, 2023 by ClaytonT Leave a Comment

You read that write v0.1.4 now supports MacOs! As long as you are using PowerShell 7.x you are good to go. Also in v0.1.4, you are now able to export your users from your main tenant into a worksheet that is easily imported into your dev tenant. You will only have to add the licensing(Please let me know if you want me to default the developer licenses). I’ve cleaned up some of the documentation and help as well. I’m really excited about this release and can’t wait to add more features! Let me know what you would like to see next.

For easy installation:

Install-Module -Name 365AutomatedLab

As always any PR, Issue, or question is always welcome. Have a great day!

Detailed Changelog:
https://github.com/DevClate/365AutomatedLab/blob/main/CHANGELOG.md

GitHub:
https://github.com/DevClate/365AutomatedLab

PowerShell Gallery:
https://www.powershellgallery.com/packages/365Automatedlab/0.1.4

Tagged With: 365, 365AutomatedLab, Automation, MacOS, Module Monday, PowerShell

Getting Started with 365AutomatedLab Part 3

October 11, 2023 by ClaytonT Leave a Comment

Adding/Removing a User from Groups by User Role

I have to say that this function is one of my favorites. The reason why is how many companies can use only dynamic groups for adding users to their required groups? Using this function, you can create any job role name, then add the groups that job role requires. If you need help mass created groups check out Creating Groups with Excel. It can become the source of truth for standard groups per job role so you are only updating one location. Please test on your dev tenant first, but with most of the other cmdlets in this module they can be used in production, after proper testing.

Adding a User to Groups by User Role

The quickest way to add groups to a user is to use the 365DataEnvironment Excel file in the LabSources folder. I’ll show you that now, and how to customize it for your environment.

New-CT365GroupByUserRole -FilePath "C:\\365AutomatedLab\\LabSources\\365DataEnvironment.xlsx" -UserEmail mwhite@yourdomain.onmicrosoft.com -Domain yourdomain.onmicrosoft.com -UserRole NY-IT

This one line of PowerShell will add Mary White to all the groups associated with the user role “NY-IT,” which are “IT 365 Group, IT, IT NY, Printer – NY – 1, and Printer – NY – 2.”

FilePath: Is the location of the Excel workbook

UserEmail: The full email of the user you want to add groups to

Domain: The domain of your tenant

UserRole: This be the name of the worksheet for that user role.

If you want to create your own user roles, all you have to do is create a new worksheet and label it with the user role you want. Then you will need 4 columns which will be “DisplayName, PrimarySMTP, Description, and Type.” For type, the 4 different options are “365Group, 365MailEnabledSecurity, 365Distribution, and 365Security” depending on which groups you want to add them to. See image below for the template:

You can create as many user roles as you want. I used NY-IT naming convention as an example, but you can use whichever you want, as I know there are too many variations on how companies handle this and didn’t want to do a validateset on it.

That’s it, that is how you create the different job roles then how you add those groups to a user!

Removing a User from Groups by Job Role

I have a feeling after reading how to add, you already know how to remove groups from a user.

Remove-CT365GroupByUserRole -FilePath "C:\\365AutomatedLab\\LabSources\\365DataEnvironment.xlsx" -UserEmail mwhite@yourdomain.onmicrosoft.com -Domain yourdomain.onmicrosoft.com -UserRole NY-IT

Was I right? I really try to make these as simple as possible as I know we all are busy enough, and don’t want to make your life any busier.

Summary

You made it! Now you can easily add and remove user groups by job role with an Excel workbook. I know this is in 365AutomatedLab, but once you have tested, you could use this in production as it is great for onboarding and offboarding users.

As always please feel free to reach out if you have any questions, comments, concerns on this project or any others! If you can please star the GitHub repository as it will help others see it. Have a great day!

GitHub: https://github.com/DevClate/365AutomatedLab

Part 1 – Creating Users with Excel

Part 2 – Creating Groups with Excel

Tagged With: 365, 365AutomatedLab, AD, Automation, Excel, Groups, PowerShell

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

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

Getting Started with 365AutomatedLab Part 1

September 29, 2023 by ClaytonT 2 Comments

Adding/Removing Users

Adding Users

With 365AutomatedLab, you can add as many users with their primary licensing as you need at one time. Currently, the Microsoft Dev Environment only allows 25 licensed users, and one is your primary account, so the max I’d recommend creating is 24 users if you’ll only be using this in a dev environment.

Quickest way to get started is by opening the 365DataEnvironment Excel Workbook in the LabSources folder. Here you can see the formatting for the cells so that a user can be added. (Let me know if you would like more attributes added, as these are required and ones I felt would be most useful to start)

View of 365DataEnvinronment.xlsx

FirstNameLastNameUserNameTitleDepartmentStreetAddressCityStatePostalCodeCountryPhoneNumberMobilePhoneUsageLocationLicense
AliceJohnsonajohnsonIT SpecialistIT1818 Maple StAlbanyNY12207USA212-555-1234212-555-5678USDEVELOPERPACK_E5

If you want to use “real” data, I’d recommend exporting your users from your production environment that you want to test, which you can use “Export-CT365ProdUserToExcel” to do this if you don’t already have a script to do so. You will have to copy the information into the 365DataEnvironment.xlsx, as the export as of right now is using Microsoft default column headers and I need to change them to match the excel sheets.

Now that you have your data all set, it’s time to add them to your Dev tenant.

New-CT365User -FilePath "C:\\Path\\to\\file.xlsx" -domain "contoso.com"

The file path is exactly what it says and you are required to type out the .xlsx or it will fail. The domain will be the domain for your tenant, if its a dev tenant it should be domainname.onmicrosoft.com. Then it will ask you to type in a password that you will user for all users.

That’s it, now you have created all your users.

Deleting Users

Now say you are done testing with those users and you want to remove them, or something you were testing changed their information too much from their original state? All you need is this line of code, and they will all be removed.

Remove-CT365User -FilePath "C:\\Path\\to\\file.xlsx" -Domain "contoso.com"

After the magic of PowerShell happens, all those users will be gone. Nice and easy, right?

Summary

Hope you found this useful, as it has saved me many times/hours when testing different scripts and changing the source data too much, then having to remember the users information to delete. I was surprised when I hadn’t seen anything like this as I know there are so many people testing in 365, and why not make it easier? Please look out for the next part of this series where you’ll be able to add and remove all the different types of groups in 365.

As always feel free to reach out anytime, and let me know what you think as well! Have a great day!

365AutomatedLab

Tagged With: 365, 365AutomatedLab, Automation, MsGraph, PowerShell

New Feature Announcement for 365AutomatedLab

September 18, 2023 by ClaytonT Leave a Comment

I wanted to let everyone know as of this morning you can add and remove Teams and Teams Channels with only 1 line of code and an Excel Worksheet using 365AutomatedLab.

It’s as simple as this:

New-CT365Teams -FilePath "C:\path\to\365DataEnvironment.xlsx" -AdminUrl "<https://yourdomain.sharepoint.com>"

And to remove those teams:

Remove-CT365Teams -FilePath "C:\path\to\365DataEnvironment.xlsx" -AdminUrl "<https://yourdomain.sharepoint.com>"

Let me know what you think. Do you want the ability to add more than 2 additional channels? Any of the other parameters you would like added for teams and channels? Eventually, I’ll add them all, but rather start with the ones that you most use.

As always feel free to reach out and I’m always open to PRs.

365AutomatedLab

Tagged With: 365, 365AutomatedLab, Automation, PowerShell, Sharepoint, Teams

One-Liner Wednesday August 2, 2023

August 2, 2023 by ClaytonT Leave a Comment

Have you ever needed to create multiple 365 Groups/Security/Distribution at one time? This could be for a new department, new office, or even a new campaign that only certain people need access and email to. I won’t even go into the time it would take to do this in the GUI, but how would you add them scripting wise, as there are 4 types of Groups/Lists in 365. Do you only do one cmdlet at a time and hope someone doesn’t come back after you’ve already done some and they need to add another group with a cmdlet you’ve already used?

I have a nice simple one-liner to fix this issue.

Add-CT365Group -FilePath "C:\\Path\\to\\file.xlsx" -UserPrincialName "admin@domain.com" -Domain "domain.com"

That’s it.

Ok, to be fair, PowerShell wise that is all there is to it other than installing the 365AutomatedLab module from Github. After that only 3 steps needed, and well worth it. Here are the steps:

  1. Create a workbook in Excel, and have a sheet named “Groups”
  2. Add the Headers “DisplayName”, “PrimarySMTP”, “Description”, “Owner”, and “Type”
    1. DisplayName is self explanatory as this will be the Display name for the group
    2. PrimarySMTP is the email address without the @domain.com
    3. Description is self explanatory as this will be the description value for the group
    4. Owner is only a placeholder, but will be adding that soon
    5. Type will be the type of group it is – and will pull the corresponding cmdlet
      1. 365Group
      2. 365MailEnabledSecurity
      3. 365Distribution
      4. 365Security
  3. Add your Group information in the corresponding fieldsExcel worksheet example

After those are filled in, you can run the script from above pointing to where you saved that excel file, and all those groups you added to the Excel worksheet named “Groups” will be added (As long as you have the correct permissions)

It’s really that simple. I’m looking to expand the properties you can add into the groups, if there are any you’d rather see first, please let me know.

I hope you found this useful and it saves you time/headaches from having to more manually add them! As always if I can help out in anyway, please feel free to reach out!

Microsoft Documentation on Group Types

New-UnifiedGroup

New-DistributionGroup

New-MgGroup

Tagged With: 365, 365AutomatedLab, Automation, Groups, One Liner Wednesday, PowerShell

  • « Go to Previous Page
  • Page 1
  • Interim pages omitted …
  • Page 5
  • Page 6
  • Page 7
  • Page 8
  • Page 9
  • Go to Next Page »

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

  • EntraFIDOFinder: New Web UI and Over 70 New Authenticators
  • January 19, 2026 Updates to EntraFIDOFinder
  • v0.0.20 EntraFIDOFinder is out
  • EntraFIDOFinder Update
  • Did you know: SSPR/Password Reset Edition

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
  • Windows
  • WSUS

© 2026 Clatent