PowerShell Office 365 Inventory tool

I’ve thought of creating a different tool after creating the PowerShell Office 365 tool a couple of days ago to improve my PowerShell coding and to make my work and that of my colleagues a little bit easier. The PowerShell Office 365 inventory tool lists a lot of information you would like to see when troubleshooting or getting information from a tenant you never connected to.

You can follow and download the PowerShell Office 365 Inventory Tool at GitHub: https://github.com/peetersm12/Office365Inventory-GUI

This PowerShell Office 365 Inventory tool will retrieve the following information:

  • Azure Active Directory Users
  • Azure Active Directory Deleted Users
  • Azure Active Directory External Users
  • Azure Active Directory Contacts
  • Azure Active Directory Groups
  • Azure Active Directory Licenses
  • Azure Active DIrectory Domains
  • Exchange Mailboxes
  • Exchange Archives
  • Exchange Groups
  • SharePoint Sites
  • SharePoint Webs

Please note that you will need a few pre-requisites before fully able to run this tool:

Please let me know which information you would like to see added to this tool and I’ll add this is as soon as possible.

FrontWindow2

[How to] PowerShell Office 365 Inventory Tool

image

Run ‘Start-Office365Inventory.ps1’. You will automatically be asked to run as administrator if you ran this as a normal user.

image

First Connect to Office 365 by clicking on the credential logo, by pressing f4 or via the menu

image
Fill in your credentials and press OK

image

You are connecting successfully when the icons are green.

There are 2 possible actions now:

  • Navigate to a tab and run only this action
  • Press the run all button to run all available actions

image

Only the Azure Active Directory Licenses have been returned. You can verify which actions have been run on the home tab.

image

Now click on the run all actions button. You can see the progress on the Home tab.

Please note that you will need site collections permissions for the SharePoint Webs option as this uses CSOM to connect to the different webs.

You will receive the following message but it will continue looking for more webs

image

After all actions everything should be green

image

Run the action individually if you encounter an error as the exception will be shown in the below message center.

Reports
You can create a .CSV or .HTML file based on the items visible at any time in the view by clicking on the button next to the CSV Report.
The report will be saved to the report folder located in the script root.

The .CSV report will look like:
report1

The .HTML report will look like:
report2

It is also possible to create a .HTML file for all the available tabs in a nice format. Please note that this is still a work in progress but it will lists everything at the moment.

report3

Error log
Some error information is displayed on the background PowerShell window as other information is only readable using the errorlog.
Please send me this information and the message in the below message box if you encounter an error.

image

PowerShell Office 365 Groups Tool

I’ve been looking for a tool to easily manage Windows Updates on servers and found the PoshPAIG tool by Boe Prox at https://learn-powershell.net/ which has been created with PowerShell with a nice GUI. A colleague of mine wanted a Office 365 Groups tool to easily restore Office 365 Groups and this GUI is perfect for this kind of functionality. Please let me know in a comment what you think of the tool and if you would like to see some added functionality regarding Office 365 Groups. To be able to use this tool you will need to have the new Azure AD preview module which you can download at https://docs.microsoft.com/en-us/powershell/azure/install-adv2?view=azureadps-2.0.

The code can be downloaded from github at https://github.com/peetersm12/Office365Groups-GUI

[How to] PowerShell Office 365 Groups Tool

Actions
image
Run ‘Start-Office365GUI.ps1’. You will automatically be asked to run as administrator if you ran this as a normal user.

image
First Connect to Office 365 by clicking on the run button

image
Fill in your credentials and press OK.
The tool will now create a remote PowerShell connection to Exchange Online and connect to Azure AD

image
Switch the drop down to ‘Get Office 365 Groups’ and run this action

image
The active Office 365 groups are now listed.

image
Now switch to ‘Get deleted Office 365 Groups’ and run this action

image
The deleted Office 365 groups are now listed

image
You can now select ‘Restore Office365 Groups’ in the drop down.
Then select all the groups you wish to restore and run this action

image
Run Action

image
The tool will restore 2 groups at the same time

image
Rerun the ‘get deleted…’ and ‘get Office 365…’ actions to verify if the group has been restored (It may take some time for it to be visible in the active groups list)
Issue a.t.m.: The run button is active but picture not enabled

image

image

Reports
You can create a .CSV or .HTML file based on the items visible at any time in the view by clicking on the button next to the CSV Report.
The report will be saved to the report folder located in the script root.

The .CSV report will look like:
image

The .HTML report will look like:
image

Error log
Some error information is displayed on the background PowerShell window as other information is only readable using the errorlog.
Please send me this information if you encounter an error.

image

Get Office 365 Admin Roles using PowerShell

Office 365 has a couple of admin roles which can be assigned to different users. With the below PowerShell one-liner you can get the Office 365 Admin Roles in 1 overview.

Get-MsolRole | %{$role = $_.name; Get-MsolRoleMember -RoleObjectId $_.objectid} | select @{Name="Role"; Expression = {$role}}, DisplayName, EmailAddress

You’ll first need to connect to the Office 365 tenant using “Connect-MsolService” and then enter the above one-liner

image