Monday, March 30, 2020

Grant-CsTeamsUpgradePolicy to teams only for bulk user from CSV file (upgrade MS teams from Island mode to Teams only)


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#http://hilite.me/
# Loop through all the records in the CSV
Import-Module SkypeOnlineConnector
$userCredential = Get-Credential
$sfbSession = New-CsOnlineSession -Credential $userCredential
Import-PSSession $sfbSession

$employee_list = Import-Csv 'C:\Temp\skypetoteams\phase1\Skype to Teams Phase-1 users.csv'
$Datetime= Get-Date -Format dd_MM_yyyy_HH.mm.ss
$LogFileName=([string]::Concat("C:\Temp\skypetoteams\phase1\Log_Skype to Teams Phase-1 users " , $Datetime ,".csv"))
New-Item  $LogFileName  -ItemType file

Add-Content $LogFileName -Value ([string]::Concat("User email" +","+ "Current Team upgrade policy"))
Write-Host "Getting all user from csv.."
    foreach ($employee in $employee_list) 
    
    {
    
        $employeeEmail= $employee.Email
        Write-Host $employeeEmail
        Grant-CsTeamsUpgradePolicy -PolicyName UpgradeToTeams -Identity $employeeEmail
        $userteampolicy = Get-CSOnlineUser -Identity $employeeEmail| Select TeamsUpgradeEffectiveMode
        Add-Content $LogFileName -Value ([string]::Concat($($employeeEmail) +","+ $($userteampolicy)))
         
    }

Write-Host "Completed.."

No comments:

Post a Comment

HTML

Script:

JS