Wednesday, April 29, 2020

Get the list of Microsoft Teams Coexistence mode (Teams only, Island mode, Skype online)


1
2
3
4
5
6
Import-Module SkypeOnlineConnector
$userCredential = Get-Credential
$sfbSession = New-CsOnlineSession -Credential $userCredential
Import-PSSession $sfbSession

Get-CsOnlineUser | select DisplayName,UserPrincipalName,TeamsUpgradePolicy,TeamsUpgradeEffectiveMode | export-csv C:\Temp\TeamReportfile29.csv -NoTypeInformation

Monday, April 27, 2020

Create a new office 365 application instance for an Auto Attendant and Call Queue


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
#http://hilite.me/
Import-Module SkypeOnlineConnector
Import-PSSession $sfbSession

$userCredential = Get-Credential
$sfbSession = New-CsOnlineSession -Credential $userCredential

#For new application instance for an Auto Attendant
New-CsOnlineApplicationInstance -UserPrincipalName Test.AutoAttendent@test.com -ApplicationId ce933385-9390-45d1-9512-c8d228074e07 -DisplayName "Test Auto Attendent"

#For new application instance for a Call Queue
New-CsOnlineApplicationInstance -UserPrincipalName Test.Queue@test.com -ApplicationId 11cd3e2e-fccb-42ad-ad00-878b93575e07 -DisplayName "Test Call Queue"

Change office 365 user usagelocation using powershell


1
2
3
4
5
6
7
#http://hilite.me/
# Find the Country code from  https://www.iso.org/obp/ui/#search/code/
# Look for column alpha-2 (A2) two-letter country or region code

$userCredential = Get-Credential
Connect-MsolService -Credential $userCredential
Set-MsolUser -UserPrincipalName sanjiv.test@test.com -UsageLocation "FR"

Tuesday, April 7, 2020

How to assign Office 365 Roles using powershell reading CSV file


 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
28
29
30
31
32
33
34
35
36
37
Install-Module MSOnline
$AzureAdCred = Get-Credential
Connect-MsolService -Credential $AzureAdCred
Get-MsolRole #Check all the roles
$employee_list = Import-Csv 'C:\Temp\Role\OperationRole.csv'

  foreach ($employee in $employee_list) 
    
    {

    $UserEmailAddress = $employee.Email
    Write-Host $UserEmailAddress

    Add-MsolRoleMember -RoleName 'Guest Inviter' -RoleMemberEmailAddress $UserEmailAddress
    Add-MsolRoleMember -RoleName 'User Account Administrator' -RoleMemberEmailAddress $UserEmailAddress
    Add-MsolRoleMember -RoleName 'Helpdesk Administrator' -RoleMemberEmailAddress $UserEmailAddress
    Add-MsolRoleMember -RoleName 'Service Support Administrator' -RoleMemberEmailAddress $UserEmailAddress
    Add-MsolRoleMember -RoleName 'Directory Readers' -RoleMemberEmailAddress $UserEmailAddress
    Add-MsolRoleMember -RoleName 'Exchange Service Administrator' -RoleMemberEmailAddress $UserEmailAddress
    Add-MsolRoleMember -RoleName 'SharePoint Service Administrator' -RoleMemberEmailAddress $UserEmailAddress
    Add-MsolRoleMember -RoleName 'Lync Service Administrator' -RoleMemberEmailAddress $UserEmailAddress
    Add-MsolRoleMember -RoleName 'Security Reader' -RoleMemberEmailAddress $UserEmailAddress
    Add-MsolRoleMember -RoleName 'Reports Reader' -RoleMemberEmailAddress $UserEmailAddress
    Add-MsolRoleMember -RoleName 'Message Center Reader' -RoleMemberEmailAddress $UserEmailAddress
    Add-MsolRoleMember -RoleName 'Desktop Analytics Administrator' -RoleMemberEmailAddress $UserEmailAddress
    Add-MsolRoleMember -RoleName 'License Administrator' -RoleMemberEmailAddress $UserEmailAddress
    Add-MsolRoleMember -RoleName 'Authentication Administrator' -RoleMemberEmailAddress $UserEmailAddress
    Add-MsolRoleMember -RoleName 'Message Center Privacy Reader' -RoleMemberEmailAddress $UserEmailAddress
    Add-MsolRoleMember -RoleName 'Compliance Data Administrator' -RoleMemberEmailAddress $UserEmailAddress
    Add-MsolRoleMember -RoleName 'Global Reader' -RoleMemberEmailAddress $UserEmailAddress
    Add-MsolRoleMember -RoleName 'Search Administrator' -RoleMemberEmailAddress $UserEmailAddress
    Add-MsolRoleMember -RoleName 'Search Editor' -RoleMemberEmailAddress $UserEmailAddress
    Add-MsolRoleMember -RoleName 'Password Administrator' -RoleMemberEmailAddress $UserEmailAddress
    Add-MsolRoleMember -RoleName 'Groups Administrator' -RoleMemberEmailAddress $UserEmailAddress
    

}

How to remove Office 365 Global Admins reading from CSV file

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
Install-Module MSOnline
$AzureAdCred = Get-Credential
Connect-MsolService -Credential $AzureAdCred

$employee_list = Import-Csv 'C:\Temp\Role\OperationRole.csv'

  foreach ($employee in $employee_list) 
    
    {

    $UserEmailAddress = $employee.Email
    Write-Host $UserEmailAddress

    Remove-MsolRoleMember -RoleName "Company Administrator" -RoleMemberType User -RoleMemberEmailAddress $UserEmailAddress

}

HTML

Script:

JS