IT Knowledge Base

User Tools

Site Tools


Contact me at for any feedback or suggestions.

My other sites:

Search all my sites:


Office 365 PowerShell

Office 365

$cred = Get-Credential
$session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri -Credential $cred -Authentication Basic -AllowRedirection
Import-PSSession $session
... your commands here ...
Remove-PSSession $session

Commands Possible

  • Show all O365 users whether they have a mailbox or not: Get-User
  • Show all Exchange mailboxes: Get-Mailbox

Exchange Online

This method requires the Azure AD PowerShell CMDlets - note the system requirements - will run on Server 2008 R2 and above. Non-R2 version of Server 2008 is NOT supported, the CMDlets will not install. This means it also does not work on SBS 2008.

Do the following from the icon titled “Microsoft Azure Active Directory Module for Windows PowerShell”, I had errors when running it directly from PowerShell.

Import-Module MSOnline

Commands Possible

  • Set all passwords to the same thing: Get-MsolUser | Set-MsolUserPassword -NewPassword Pas!sword2014 -ForceChangePassword 0
  • Set all passwords to never expire: Get-MsolUser | Set-MsolUser –PasswordNeverExpires $True
office_365_powershell.txt · Last modified: 2018/04/09 09:56 (external edit)