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 } |
Tuesday, April 7, 2020
How to assign Office 365 Roles using powershell reading CSV file
Subscribe to:
Post Comments (Atom)
HTML
Script:
No comments:
Post a Comment