Puzzled by another issue with different outputs when running a script from Powershell ISE compared to a standard shell.
I am performing a number of SQL checks and formatting the resultset as an HTML fragment:
$html1 = $dataset1.Tables .......... ConvertTo-HTML -AS Table -fragment -PreContent '<h2>SQL Configuration</h2>' | Out-String
These fragments are then associated with variables covering each block of tests:
$svrconfig = $html1, $html2
$memory = $html3,$html4
The main body of HTML is defined as a variable (a$) containing div blocks for each of the variables listed above:
<div id+""Server Configuration"" class=""tabcontent"">" + $memory +"</div>
When running the final convert under ISE, a complete HTML document is produced with the variables in the div blocks being correctly substituted with the relevant HTML.
However, when executed under a standard Powershell shell with administrative rights, the final HTML conversion does not see the div variables being populated:
ConvertTo-HTML -body $a | Out-File -append $SQLStatusReport
As usual, any pointers gratefully received!
JC
Our community of experts have been thoroughly vetted for their expertise and industry experience.
The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.