12Knocksinna / Office365itpros

Office 365 for IT Pros PowerShell examples

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issue 01

vitusq opened this issue · comments

Hi,

As soon as this script is executed, it display the following errors:

Attempted to divide by zero.
At C:\temp\test.ps1:85 char:1

  • $PercentInactive = (($Guests.Count - $Active)/$Guests.Count).toString ...
  •   + CategoryInfo          : NotSpecified: (:) [], RuntimeException
      + FullyQualifiedErrorId : RuntimeException
    
    
    

Statistics

Guest Accounts 0
Active Guests 0
Audit Record found 0
Active on Email 0
InActive Guests 0
Percent inactive guests
Cannot index into a null array.
At C:\Temp\test.ps1:95 char:1

  • Write-Host ("Domain with most guests {0} ({1})" -f $DomainsCount[0]. ...
  •   + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
      + FullyQualifiedErrorId : NullArray
    
    

Guests from domains

The output file containing detailed results is in c:\temp\GuestActivity.csv

Obviously the calls to find information didn't succeed. Your account probably doesn't have the right permissions (or if it's a Graph-based script, the underlying registered app doesn't have the right permissions). Can you check those things?