Forum Discussion

BrendenJP's avatar
BrendenJP
Copper Contributor
Jul 27, 2023

Checking whether a EDU_Class team has been activated

Hi everyone

 

Is there any good way in PowerShell to check whether a teacher/owner has activated a team assigned to them?

 

Thanks in advance!

2 Replies

  • LeonPavesic's avatar
    LeonPavesic
    Silver Contributor

    Hi BrendenJP,

    you can try to use this PowerShell script to check if a teacher has activated a team:

     

    # Install Microsoft Teams PowerShell Module
    Install-Module -Name PowerShellGet -Force -AllowClobber
    Install-Module -Name Teams -Force -AllowClobber
    
    # Connect to Microsoft Teams using Office 365 credentials
    Connect-MicrosoftTeams
    
    # Check Activation Status for Teams Assigned to the Teacher/Owner
    $teacherEmail = "email address removed for privacy reasons"
    $teams = Get-TeamUser -User $teacherEmail
    
    foreach ($team in $teams) {
    $teamDetails = Get-Team -GroupId $team.GroupId
    $isActive = $teamDetails.IsFavoriteByTeacher
    $teamName = $teamDetails.DisplayName
    
    Write-Output "Team: $teamName - Activation Status: $isActive"
    }

    Let me explain in short what the Script does.

    Script installs the Microsoft Teams PowerShell module using `Install-Module` and connects to Microsoft Teams using `Connect-MicrosoftTeams` with Office 365 credentials (use Global Admin account).

    Then, it checks the activation status of Teams assigned to the specified teacher/owner (`email address removed for privacy reasons`) using `Get-TeamUser`.

    PowerShell script should list all Teams assigned to the teacher/owner and their activation status.

     

    Please click Mark as Best Response & Like if my post helped you to solve your issue.
    This will help others to find the correct solution easily. It also closes the item.


    If the post was useful in other ways, please consider giving it Like.


    Kindest regards,


    Leon Pavesic

    • BrendenJP's avatar
      BrendenJP
      Copper Contributor

      LeonPavesic 

      Thank you kindly for your reply, but 

      IsFavoriteByTeacher

      does not seem to be a valid argument for a team and returns an error when I try to call it.