How to use Powershell to manage O365 admin center

Wu Yuki 81 Reputation points
2021-04-21T08:07:59.01+00:00

Hello !
anyone know how to use powershell to manage O365 admin center ?

For example , to add member to share mail box or to change the user's region or location .

thanks for sharing .

Exchange Online
Exchange Online
A Microsoft email and calendaring hosted service.
6,171 questions
0 comments No comments
{count} votes

Accepted answer
  1. Vasil Michev 119.5K Reputation points MVP Volunteer Moderator
    2021-04-21T13:43:01.547+00:00

    You can use the Set-MsolUser or Set-AzureADUser cmdlets for that. As for automating this, it's certainly doable, I can provide you with a short example on how to do it as long as you specify which exact property you are looking to modify.


2 additional answers

Sort by: Most helpful
  1. Vasil Michev 119.5K Reputation points MVP Volunteer Moderator
    2021-04-21T09:29:59.113+00:00

    This will depend on which tasks you want to perform. For things such as managing mailboxes or Distribution groups, use the Exchange Online PowerShell module: https://learn.microsoft.com/en-us/powershell/exchange/exchange-online-powershell-v2?view=exchange-ps

    For managing user properties, use the MSOnline or AzureAD modules: https://learn.microsoft.com/en-us/powershell/module/azuread/?view=azureadps-2.0


  2. Joyce Shen - MSFT 16,701 Reputation points
    2021-04-22T05:57:15.997+00:00

    Hi @Wu Yuki

    For example, if you want to add users and license them, you need be a global, license, or a user admin.

    In Exchange side, refer to this: Create user mailboxes in Exchange Online

    You could use the command like this to perform the action:

    New-Mailbox -Alias hollyh -Name hollyh -FirstName Holly -LastName Holt -DisplayName "Holly Holt" -MicrosoftOnlineServicesID ******@corp.contoso.com -Password (ConvertTo-SecureString -String 'P@ssw0rd' -AsPlainText -Force) -ResetPasswordOnNextLogon $true  
    

    In addition, we can use Get-ManagementRole -Cmdlet xxx-xxx to get what roles are needed to run the command.


    If an Answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
     


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.