Tuesday, April 7, 2020

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

}

No comments:

Post a Comment

HTML

Script:

JS