Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[VariableIsUndefined] Error in Word document output #129

Open
rebelinux opened this issue Mar 30, 2024 · 0 comments
Open

[VariableIsUndefined] Error in Word document output #129

rebelinux opened this issue Mar 30, 2024 · 0 comments

Comments

@rebelinux
Copy link

rebelinux commented Mar 30, 2024

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:

  1. Relaunch the powershell session
  2. Disable the strict mode: Set-StrictMode -Off
  3. 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>

Reference Code:

$Images += @($subSection)

Environment:

PS C:\Users\jocolon> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.19041.3803
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.3803
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

PS C:\Users\jocolon>

PScribo version:

PS C:\Users\jocolon> get-module pscribo -ListAvailable

    Directory: C:\Program Files\WindowsPowerShell\Modules

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     0.10.0     PScribo                             {BlankLine, Document, DocumentOption, Export-Document...}

PS C:\Users\jocolon>
@rebelinux rebelinux changed the title [VariableIsUndefined] Error in Word Document output [VariableIsUndefined] Error in Word document output Mar 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant