How to Administer client Office 365 accounts via PowerShell

Iron Contributor

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

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-PowerS...

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