Teams Open Hack Automation

Overview

This script will create a team, add owner(s), add coaches as members, and add 1-99 channels formatted as "Team 01…Team 99".

Ensure your policy does not block you from running PowerShell scripts

  1. Open PowerShell as Admin
  2. In the command window, run the following command
    • Note: When running, you will be asked to accept changes to the execution policy. Please respond with Yes or Yes to All to all prompts.

Example of enabling PS

Install the Teams module

  1. Open PowerShell as Admin
  2. In the command window, run the following command:

Install-Module -Name MicrosoftTeams

Example of PowerShell command

Run the script

  1. Open your PowerShell editor of choice (e.g. Visual Code, PowerShell IDE, etc.)
  2. Open the script: Teams Automation.ps1
  3. Set the variables according to your OH needs. (See the "Variables Examples" below.)

Variables Examples
Example of variables


Variable Description Examples
teamName The name of the Team, NOT the name of the channels
  • MyTeam
  • My Team
  • My Team Name Is Longer Than Yours
teamDescription The purpose of the team, for everyone to see "OpenHack channel for attendees and coaches to collaborate"
teamVisibility Allows the team to be hidden or discoverable
  • Public
  • Private
teamOwnerOverride Allows you to specify someone else's email alias (i.e. you are creating a team for someone else to own). When left blank, the script will add the person running the script as the default owner.
  • Blank
    • creates you as the owner
  • alias@microsoft.com (MUST BE AN EMAIL!!!)
    • creating a team for someone else
numOfTeams The number of channels to create based on the number of teams you expect 1 - 99
admins Adds the array of email aliases specified as Owners of the Team. Specify them as strings that are comma delimited.
coaches Adds the array of email aliases specified as Members of the Team. Specify them as strings that are comma delimited.
  1. Save changes and run the script

Known Errors and Workarounds

First Time Creating a Team

When creating the team for the first time, the SDK is throwing an error as shown. Run the script again and say "Y" to continue working with the found team.

Error thrown the first time you create a team