About
Pricing
Community
Teams
Start Free Trial
Log in
Suresh Kumar
asked on
3/10/2017
Ouput in html in powershell
[cmdletbinding()]
param
(
[Parameter(Position=0,Valu
efromPipel
ine=$true)
]
[string[]$ComputerName = $env:ComputerName
)
$vers = Invoke-Command -ComputerName $ComputerName -ScriptBlock { New-Object PsObject -Property @{ Version = opctemplate} }
$a = @"
<style>
TABLE{border-width: 1px;border-style: solid;border-color: black;border-collapse: collapse;}
TH{border-width: 1px;padding: 0px;border-style: solid;border-color: black;}
TH{border-width: 1px;padding: 0px;border-style: solid;border-color: black;}
TD{border-width: 1px;padding: 0px;border-style: solid;border-color: black;}
</style>
"@
$vers | ConvertTo-html -Head $a -body "<H2>Version </H2>" -Property Version | Out-file -Filepath C:\tmp\ver.html
When i run the above script i get the ouput as
List of Policies
* List installed policies for host 'localhost'. Type Name Status Version --------------------------
----------
----------
----------
----------
-- configsettings "OPC_COND_EVT_LOG_SRC_PAT"
enabled 0001.0000 le "LAG_Administrator group Alert" enabled 0001.0028 le "Win2k-AppEventLog" enabled 0001.0036 le "Win2k-SecEventLog" enabled 0001.0005 le "Win2k-SysEventLog" enabled 0001.0027 monitor "BladeLogic Restart if over 30% CPU" enabled 0001.0004 monitor "Lanman_ServiceMon" enabled 0001.0004 monitor "Log Monitoring Service Restart if over 30% CPU" enabled 0001.0001 monitor "SEP_Monitoring" enabled 0001.0005 monitor "TripwireServiceMon" enabled 0001.0001 monitor "Win2k-VirtualMemoryUtiliz
ation" enabled 0001.0009 msgi "Win2k-opcmsg" enabled 0001.0051 sched "Win2k-DiskSpace-Friday000
0AM-1600PM
" enabled 0001.0001 sched "Win2k-DiskSpace-Monday-Th
ursday" enabled 0001.0001 sched "Win2k-DiskSpace-Sunday080
0AM_2359PM
" enabled 0001.0001 sched "Win2k-DiskSpaceConf" enabled 0001.0007
But I need the output in the below format
Type Name Status Version
--------------------------
----------
----------
----------
----------
--
configsettings "OPC_COND_EVT_LOG_SRC_PAT"
enabled 0001.0000
le "LAG_Administrator group Alert" enabled 0001.0028
le "Win2k-AppEventLog" enabled 0001.0036
le "Win2k-SecEventLog" enabled 0001.0005
le "Win2k-SysEventLog" enabled 0001.0027
monitor "BladeLogic Restart if over 30% CPU" enabled 0001.0004
monitor "Lanman_ServiceMon" enabled 0001.0004
monitor "Log Monitoring Service Restart if over 30% CPU" enabled
0001.0001
monitor "SEP_Monitoring" enabled 0001.0005
monitor "TripwireServiceMon" enabled 0001.0001
monitor "Win2k-VirtualMemoryUtiliz
ation" enabled 0001.0009
msgi "Win2k-opcmsg" enabled 0001.0051
sched "Win2k-DiskSpace-Friday000
0AM-1600PM
" enabled 0001.0001
sched "Win2k-DiskSpace-Monday-Th
ursday" enabled 0001.0001
sched "Win2k-DiskSpace-Sunday080
0AM_2359PM
" enabled 0001.0001
sched "Win2k-DiskSpaceConf" enabled 0001.0007
can you help me on this
Powershell
HTML
2
1
Last Comment
Suresh Kumar
8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
oBdA
3/10/2017
THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Suresh Kumar
3/10/2017
ASKER
thanks!!!
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck