Inicio > English Articles, Office365 > Office365 Administration with Powershell

Office365 Administration with Powershell


On this post, i´ll explain what we need to connect and administrate Office365 with powershell.

The first thing we will do is download and install Powershell if we don´t already have it.

The second thing will be to download and install the Microsoft Online Services Sign In Assistant (it says beta but it´s the last versión you need to install)

The third thing will be to download and install the Office365 Cmdlets (we will need it for running Online Services commands). for 32bits and for 64bits depending on the OS you have.

  • The next thing we´ll do is check that we have the environment correctly configured in order to run sequences for Office365:
    • Start PowerShell as Administrator.
    • Run the command «Get-ExecutionPolicy» and we will get a value, if the obtained value is NOT equal to «Remote Signed» we will have to change it using the command «Set-ExecutionPolicy RemoteSigned» (this way we indicate to the system that all scripts we run, must be signed by a trusted publisher)
    • Start a Command line as Admin (cmd) and run the following commands:
      • net start winrm
      • winrm get winrm/config/client/auth
      • winrm set winrm/config/client/auth @{Basic=»true»}
  • Once the environment is installed and checked, start Powershell as Admin and run the following commands:
    • $LiveCred = Get-Credential  (Get the Office365 Administration credentials of our subscription)

    • $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri -Credential $LiveCred -Authentication Basic -AllowRedirection (here we pass the introduced credentials to the Session variable in order to be used on our Office365 subscription via powershell)
    • Import-PSSession $Session (and finally import the session from the server, in order to work on it).

Once it´s all done, we can start working and do all the modifications we want over our Office365 subscription, like creating a shared mailbox, assign permissions over a mailbox and much more…

To get an idea of the commands you can use on this environment for Office365, here´s a list fo the available Cmdlets, nut the best thing we can do is investigate using the command Get-Help <command> ;).

Debes estar registrado para dejar un comentario.