[cmdletbinding()]
param
(
[Parameter(Position=0,ValuefromPipeline=$true)]
[string[]$ComputerName = $env:ComputerName
)
$vers=Invoke-Command -ComputerName $ComputerName -ScriptBlock { opcagt -version }
$a = "<style>"
$a = $a + "TABLE{border-width: 1px;border-style: solid;border-color: black;border-collapse: collapse;}"
$a = $a + "TH{border-width: 1px;padding: 0px;border-style: solid;border-color: black;}"
$a = $a + "TH{border-width: 1px;padding: 0px;border-style: solid;border-color: black;}"
$a = $a + "TD{border-width: 1px;padding: 0px;border-style: solid;border-color: black;}"
$a = $a + "</style>"
$vers| ConvertTo-html -Head $a -body "<H2>Version </H2>" | Out-file -Filepath C:\tmp\ver.txt
echo $ComputerName ,$vers
invoke-Expression c:\tmp\ver.txt
$vers | ConvertTo-html -Head $a -body "<H2>Version </H2>" | Out-file -Filepath C:\tmp\ver.txt
Get-Content 'C:\tmp\ver.txt' | Foreach-Object {$_ -replace '^<html.*$', ("<html>")}| Set-Content 'C:\tmp\ver1.txt'
cat C:\tmp\ver1.txt
This script works fine in the remote computer to find the OV version .but when tried to get the output in HTML..it gives me a different output like PSCcomputerName,RunspaceId,PSShow ComputerName,Length
Can some one help me on this
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.