Skip to content

A module that helps to manage some tasks on Office 365/Azure via undocumented API

Notifications You must be signed in to change notification settings

RichardMawdsley/O365Essentials

 
 

Repository files navigation

O365Essentials - PowerShell Module

This PowerShell module is highly experimental collection of PowerShell commands to help with Office 365 operations using undocumented and unsupported APIs (among standard graph API calls). While the module works just fine today, it may break in the future, as it's impossible to tell how and when Microsoft will update the APIs. As there are no other ways to achive most of the actions done by this module, it is what it is. You either do it via unsupported API or you're stuck using things manually.

This module wouldn't happen without great help from following people:

It is recommended to use PowerShell 7 or higher. While the module does work in PowerShell 5.1 the error handling of RestMethod is superior in PowerShell 7 so all errors are more readable in it.

Installing

Everyone can install this module from PowerShellGallery hosted by Microsoft. It's recommended way to work with the module. Version on PowershellGallery is optimized for speed and signed. Using code from GitHub is recommended for development.

Install-Module -Name O365Essentials -AllowClobber -Force

Force and AllowClobber aren't necessary, but they do skip errors in case some appear.

Updating

Update-Module -Name O365Essentials

That's it. Whenever there's a new version, you run the command, and you can enjoy it. Remember that you may need to close, reopen PowerShell session if you have already used module before updating it.

The essential thing is if something works for you on production, keep using it till you test the new version on a test computer. I do changes that may not be big, but big enough that auto-update may break your code. For example, small rename to a parameter and your code stops working! Be responsible!

Usage

First we need to connect to O365. This is done using Connect-O365Admin command. If we don't have MFA we can automate connection around Credentials.

if (-not $Credentials) {
    $Credentials = Get-Credential
}
# This makes a connection to Office 365 tenant
# since we don't want to save the data we null it out
# keep in mind that if there's an MFA you would be better left without Credentials and just let it prompt you
$null = Connect-O365Admin -Verbose -Credential $Credentials

If we have MFA we simply let it query you for MFA code.

$null = Connect-O365Admin -Verbose

Once the connection is established we can use the module using any GET/SET commands.

Get-O365Domain -Verbose | Format-Table

Get-O365DomainHealth -DomainName 'evotec.pl'

$T1 = Get-O365DomainDependencies -DomainName 'evotec.pl' -Type All -Verbose
$T1 | Format-Table

For example enabling/disabling some News Settings.

Get-O365OrgNews

Set-O365OrgNews -CompanyInformationAndIndustryEnabled $false -ContentOnNewTabEnabled $false -Verbose
Set-O365OrgNews -CompanyInformationAndIndustryEnabled $true -ContentOnNewTabEnabled $true -Verbose

All commands are listed here. You can check their usage going thru Examples section.

About

A module that helps to manage some tasks on Office 365/Azure via undocumented API

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PowerShell 100.0%