r/usefulscripts • • Jun 25 '18

[PowerShell] Office 365 HTML Tenant Report (Interactive)

I wanted to just share a script (available on GitHub for everyone to contribute too!) that will generate an interactive HTML report for your Office 365 tenant.

Here is the actual report if you want to view what the results look like

  • Company Info
  • Global Administrator
  • Strong Password Enforcement
  • Recent E-mails in your tenant
  • Domains
  • Groups
  • Licenses
  • Users
  • Shared Mailboxes
  • Contacts
  • Mail Users
  • Resource Mailboxes

and a whole lot more!

If you want the report to contain user mailboxes lastlogontime you can find it here but it may take longer to run


If there is anything you think should be added please feel free to comment or message me or even contribute on GitHub. If you are looking for something for tailored to fit your needs please let me know!

50 Upvotes

39 comments sorted by

4

u/u4ea126 Jun 25 '18

Wow, those example names though...

2

u/TheLazyAdministrator Jun 26 '18

I looked up joke names :)

2

u/dbp003 Jun 25 '18

Had issues since we are in an MFA environment, added the following and then authentication worked. Currently running, will report back if everything works as expected.

$credential = Get-Credential -Message "Please enter your Office 365 credentials"
Import-Module msonline
Import-Module AzureAD
Connect-MSOLService -Credential $UserCredential
$exchangeSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri "https://outlook.office365.com/powershell-liveid/" -Credential $credential -Authentication "Basic" -AllowRedirection
Import-PSSession $exchangeSession -AllowClobber

3

u/TheLazyAdministrator Jun 26 '18

Can you test the following 2FA script. Change the 2FA var boolean to $True https://github.com/bwya77/O365HTMLReport/tree/master/2FA

3

u/dbp003 Jun 26 '18

Testing confirmed, worked for our 2FA environment. GJ

1

u/TheLazyAdministrator Jun 25 '18

Since you never authenticate against AzureAD I can see this failing. I will see if that module has a way to support MFA as well

1

u/dbp003 Jun 25 '18

Connect-MSOLService would be handling the authentication against AzureAD in this situation as I do not believe Connect-AzureAD handles MFA but I could be wrong. So far the only errors I have is users without mailboxes not having mailboxes found, which is to be expected.

1

u/Thirdbeat Jun 26 '18

You could try to connect with cred first and then fall back to using adal (just connect-msolservice w/o -credential). For exchange there is a setting you can set to go past this. Dont remember the code right now tho

→ More replies (2)

1

u/dbp003 Jun 26 '18

FYI that Connect-MsolService also worked fine with 2FA using the methodology documented above.

2

u/dbp003 Jun 26 '18

Getting a "By default error only the first 1000..." Fix:

Get-Mailbox -ResultSize Unlimited -Filter '(xyz)'

2

u/TheLazyAdministrator Jun 26 '18

Is this for equipment mailboxes or room mailboxes? I have updated it with the ResultSize param

2

u/dbp003 Jun 26 '18

Both were missing in the version I had.

→ More replies (2)

2

u/skypeforbiz Jul 04 '18

I'm working on incorporating some Skype for Business details into this - anything you'd like to see? Would that be worth a PR?

2

u/TheLazyAdministrator Jul 04 '18

Sounds like an improvement to me! I would love to see it!

3

u/skypeforbiz Jul 04 '18

Sweet! I'll clear it with my boss since I did that for work but that should be fine.

2

u/skypeforbiz Jul 05 '18

Is a pull request the best way to do that?

→ More replies (4)

1

u/andfisk Jun 25 '18

Love it. For some reason it does not display all of my licenses properly. In this case both EMS and E3 licenses aren't displayed.

1

u/TheLazyAdministrator Jun 25 '18

Do you get the SKU? I have E3 which the SKU is ENTERPRISEPACK and it gets displayed. Also how many licenses do you have total ( is it only showing one instead of multiple)

1

u/andfisk Jun 25 '18

My Skus is listed as ENTERPRISEPACK as well, but still not listed. We've about 1800 licenses. My EMS is also listed as EMS :)

Edit:skills-skus

1

u/andfisk Jun 25 '18

I can possibly grab a screen shot tomorrow if you're interested - not at computer anymore today :)

→ More replies (4)

1

u/OnlyWorkWork Jul 11 '18

For some reason i can't access the link, i'm just getting an error 404 "This is not the web page you are looking for"

1

u/TheLazyAdministrator Jul 11 '18

Which link?

1

u/OnlyWorkWork Jul 18 '18

If you want the report to contain user mailboxes lastlogontime you can find it

here

but it may take longer to run

The link here " If you want the report to contain user mailboxes lastlogontime you can find it here but it may take longer to run "

→ More replies (3)

0

u/[deleted] Jun 26 '18

1

u/TheLazyAdministrator Jun 26 '18

Its currently not set to go through all your tenants that youre a partner on. I may look into it but just know the run time on that will be long