Hi,
the script is returning some errors, not sure about the root cause:
[PS] C:\Temp>.\Get-ExchangeOrganizationReport.ps1 -Verbose
VERBOSE: 6/28/2022 3:51:57 PM: Script started.
VERBOSE: 6/28/2022 3:51:57 PM: Company name is ACME Inc.
VERBOSE: 6/28/2022 3:51:57 PM: Creating Word ComObject
VERBOSE: 6/28/2022 3:51:59 PM: Word language value is 1033
VERBOSE: 6/28/2022 3:51:59 PM: Validating cover page Sideline for culture code en-
VERBOSE: 6/28/2022 3:51:59 PM: Loading Word templates
VERBOSE: 6/28/2022 3:52:01 PM: Starting fetching data from Active Directory and Exchange Org - Please be patient
Add-WordTable : Cannot validate argument on parameter 'Hashtable'. The argument is null, empty, or an element of the argument collection contains a null value. Supply a collection that does not contain any null values and then try the command again.
At C:\Temp\Get-ExchangeOrganizationReport.ps1:3098 char:39
-
$Table = Add-WordTable -Hashtable $HashTable `
-
~~~~~~~~~~ + CategoryInfo : InvalidData: (:) [Add-WordTable], ParameterBindingValidationException
- FullyQualifiedErrorId : ParameterArgumentValidationError,Add-WordTable You cannot call a method on a null-valued expression.
At C:\Temp\Get-ExchangeOrganizationReport.ps1:3103 char:5
-
Set-WordCellFormat -Collection $Table.Rows.Item(1).Cells -Bold -B ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull You cannot call a method on a null-valued expression. At C:\Temp\Get-ExchangeOrganizationReport.ps1:3105 char:5 + $Table.Columns.Item(1).Width = 140 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull You cannot call a method on a null-valued expression. At C:\Temp\Get-ExchangeOrganizationReport.ps1:3106 char:5 + $Table.Columns.Item(2).Width = 50 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull You cannot call a method on a null-valued expression. At C:\Temp\Get-ExchangeOrganizationReport.ps1:3107 char:5 + $Table.Columns.Item(3).Width = 50 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull You cannot call a method on a null-valued expression. At C:\Temp\Get-ExchangeOrganizationReport.ps1:3108 char:5 + $Table.Columns.Item(4).Width = 50 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull You cannot call a method on a null-valued expression. At C:\Temp\Get-ExchangeOrganizationReport.ps1:3109 char:5 + $Table.Columns.Item(5).Width = 140 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull You cannot call a method on a null-valued expression. At C:\Temp\Get-ExchangeOrganizationReport.ps1:3112 char:5 + $Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustNone) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull Add-WordTable : Cannot validate argument on parameter 'Hashtable'. The argument is null, empty, or an element of the argument collection contains a null value. Supply a collection that does not contain any null values and then try the command again.
At C:\Temp\Get-ExchangeOrganizationReport.ps1:3584 char:39 + $Table = Add-WordTable -Hashtable $HashTable + ~~~~~~~~~~ + CategoryInfo : InvalidData: (:) [Add-WordTable], ParameterBindingValidationException + FullyQualifiedErrorId : ParameterArgumentValidationError,Add-WordTable You cannot call a method on a null-valued expression. At C:\Temp\Get-ExchangeOrganizationReport.ps1:3589 char:5 + Set-WordCellFormat -Collection $Table.Rows.Item(1).Cells -Bold -B ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull You cannot call a method on a null-valued expression. At C:\Temp\Get-ExchangeOrganizationReport.ps1:3591 char:5 + $Table.Columns.Item(1).Width = 100 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull You cannot call a method on a null-valued expression. At C:\Temp\Get-ExchangeOrganizationReport.ps1:3592 char:5 + $Table.Columns.Item(2).Width = 80 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull You cannot call a method on a null-valued expression. At C:\Temp\Get-ExchangeOrganizationReport.ps1:3593 char:5 + $Table.Columns.Item(3).Width = 80 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull You cannot call a method on a null-valued expression. At C:\Temp\Get-ExchangeOrganizationReport.ps1:3594 char:5 + $Table.Columns.Item(4).Width = 100 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull You cannot call a method on a null-valued expression. At C:\Temp\Get-ExchangeOrganizationReport.ps1:3596 char:5 + $Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustNone) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull VERBOSE: Server ASEXCHYBRID01 | PageFileSize 20490 MB VERBOSE: Server ASEXCHYBRID01 | Cores 4 Add-WordTable : Cannot validate argument on parameter 'Hashtable'. The argument is null, empty, or an element of the argument collection contains a null value. Supply a collection that does not contain any null values and then try the command again. At C:\Temp\Get-ExchangeOrganizationReport.ps1:4142 char:39 + $Table = Add-WordTable -Hashtable $HashTable
+ ~~~~~~~~~~ + CategoryInfo : InvalidData: (:) [Add-WordTable], ParameterBindingValidationException + FullyQualifiedErrorId : ParameterArgumentValidationError,Add-WordTable You cannot call a method on a null-valued expression. At C:\Temp\Get-ExchangeOrganizationReport.ps1:4147 char:5 + Set-WordCellFormat -Collection $Table.Rows.Item(1).Cells -Bold -B ...
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : InvalidOperation: (:) [], RuntimeException
- FullyQualifiedErrorId : InvokeMethodOnNull
You cannot call a method on a null-valued expression.
At C:\Temp\Get-ExchangeOrganizationReport.ps1:4149 char:5
-
$Table.Columns.Item(1).Width = 100
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : InvalidOperation: (:) [], RuntimeException
- FullyQualifiedErrorId : InvokeMethodOnNull
You cannot call a method on a null-valued expression.
At C:\Temp\Get-ExchangeOrganizationReport.ps1:4150 char:5
-
$Table.Columns.Item(2).Width = 150
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : InvalidOperation: (:) [], RuntimeException
- FullyQualifiedErrorId : InvokeMethodOnNull
You cannot call a method on a null-valued expression.
At C:\Temp\Get-ExchangeOrganizationReport.ps1:4152 char:5
-
$Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustNone)
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : InvalidOperation: (:) [], RuntimeException
- FullyQualifiedErrorId : InvokeMethodOnNull
VERBOSE: 6/28/2022 3:53:24 PM: Updating the Table of Contents (ToC)
VERBOSE: 6/28/2022 3:53:25 PM: Saving Word file as: C:\Temp\Exchange-Org-Report-2022-06-28.docx
VERBOSE: 6/28/2022 3:53:27 PM: Script finished.
The script runtime was 1min 29s