There is a sporadic error when generating a word document. At first I thought it was related to AsBuiltReport modules but it happened to me in another project not related to Abr.
The error occurs at the end of the script execution and the only way I find to fix it is to:
Relaunch the powershell session
Disable the strict mode: Set-StrictMode -Off
Remove any reference of the Image cmdlet in my script
Error:
PS C:\Users\jocolon> $error
New-AsBuiltReport : The variable '$Images' cannot be retrieved because it has not been set.
At line:1 char:1
+ New-AsBuiltReport -Report Veeam.VB365 -Target veeam-vbo-01v.pharmax.l ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,New-AsBuiltReport
The variable '$Images' cannot be retrieved because it has not been set.
At line:58 char:21
+ $Images += @($subSection)
+ ~~~~~~~
+ CategoryInfo : InvalidOperation: (Images:String) [], RuntimeException
+ FullyQualifiedErrorId : VariableIsUndefined
PS C:\Users\jocolon>
Hello,
There is a sporadic error when generating a word document. At first I thought it was related to AsBuiltReport modules but it happened to me in another project not related to Abr.
The error occurs at the end of the script execution and the only way I find to fix it is to:
Set-StrictMode -Off
Error:
Reference Code:
https://github.com/iainbrighton/PScribo/blob/9382efe46d11a3689b1b6367f0f22ca317d6239d/Src/Plugins/Word/Get-WordDocument.ps1#L62
Environment:
PScribo version: