Forum Discussion

Lordkinzo's avatar
Lordkinzo
Copper Contributor
Feb 24, 2021

Using a CSV to search for Group IDs

 

Hi Guys,
Hope you can help.
I have a list of Team display names in a CSV. One Column 'Display names'
I want to use this list to retrieve the 'Group ID's of each Team in the list.
I also want to hold the results in a variable to be used in a script.
Please help


1 Reply

  • farismalaeb's avatar
    farismalaeb
    Iron Contributor

     

    Lordkinzo 

     

    $MyData=Import-csv -path C:\Mydata.csv
    Foreach($SingleTeam in $Mydata){
    $Variable=get-team -DisplayName $SingleTeam | select GroupID,Displayname
    #Do whatever else you want $Variable.GroupID
    }

     

    But make sure that you import the Teams Module

     

    Import-Module MicrosoftTeams
    $sfbSession = New-CsOnlineSession -Credential $Cred -overrideadmindomain XXXXXXXXXXXXXX.onmicrosoft.com -verbose
    Import-PSSession $sfbSession 

     

     

    -------------

    If this answer helped you, please dont forget to click on Best Respone.

     

Resources