Microsoft 365 PowerShell reference fragments

Find the captured Graph, Exchange and Teams PowerShell starting points. Some source guides are held, and the recently-created-user note describes inputs without supplying a complete query.

Microsoft Graph Module

To get started see MS Graph Basics - User Properties

Find Recently Created Users

This code will find M365 user accounts that were created in the last 14 days.

Note: It will filter out (aka not include) accounts that are missing their employeeId.

HOW TO USE:

  1. Set $schoolDomain to the email domain for your school
  2. Optionally: Adjust $numberOfDays to increase or decrease the number of days in the past to search.

The note says the intended result includes staff and student accounts. It supplies no complete query in this fragment, so the stated result cannot be verified here.

Image alternative text: web content

Exchange Online Module

To get started see Exchange Online Basics

Teams GroupClass Management - Get All Teams From M365

This powershell will return all the M365 Teams/Groups created by Teams Create Script.

Connect-MgGraph
$JTGroups = Get-MgBetaGroup -All -Filter "extension_fe2174665583431c953114ff7268b7b3_Education_CreatedByUserId eq 'c9c52a29-da16-49bb-aaf1-2808c91d8a87'" -ConsistencyLevel "eventual" -CountVariable $count