Forum Discussion

Jason Rhodes's avatar
Jason Rhodes
Iron Contributor
Apr 14, 2017

How to Administer client Office 365 accounts via PowerShell

Hi,

 

I'd like to be able to manage all of our client Office 365 tenants via PowerShell.

 

However when I try to login to PowerShell using the global admin account credentials, this does not allow me to login to PowerShell.

 

What's the best wasy for me to do what I'm trying to do?

2 Replies

  • Gorazd Nadižar's avatar
    Gorazd Nadižar
    Copper Contributor

    Hi,

     

    You can try this code, it works for me : 

     

    Set-ExecutionPolicy RemoteSigned
    $UserCredential = Get-Credential
    $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
    Import-PSSession $Session
  • Zeff Wheelock's avatar
    Zeff Wheelock
    Copper Contributor

    Greetings,

     

    We need to know a little more details, such as the error you are getting, what command you have tried, etc.  There is a little setup required such as installing WIndows Framework 4.0 or 5.0, installing the Microsoft Sign-on assistant, etc.  Here are some references to what you need to do:

     

    https://technet.microsoft.com/en-us/library/jj984289(v=exchg.160).aspx

    https://community.spiceworks.com/how_to/28793-managing-office-365-using-powershell

    https://support.office.com/en-us/article/Managing-Office-365-and-Exchange-Online-with-Windows-PowerShell-06a743bb-ceb6-49a9-a61d-db4ffdf54fa6

Resources