I have a main script that is calling on several others scripts and I need to load the variables from the other scripts into the main script so that I can dump them into a html file. I tried dot sourcing the scripts I am calling on but that did not work or I am doing something wrong. Any help would be appreciated.
Example section of script:
.\get-cluster.ps1
$MyReport += Get-CustomHeader "Clusters not in compliance : $($CapacityInfo.count) ($MyReport += Get-HTMLTable $capacityinfo
$MyReport += Get-CustomHeaderClose
The variable $capacityinfo exists in the get-cluster.ps1 script
Unless your get-cluster.ps1 file is in your root dir, dot source would look more like this:
This will execute the Get-Cluster.ps1 script in the same scope as the caller making its script level variables available in the caller.