Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Convet to HTML

$
0
0

How can I  convert my script to HTML?  I've tried with convertto-html but it comes out unformatted.

import-module failoverclusters
$clustername = 'myclustername'

$resources = get-cluster $clustername | get-clusterresource | select OwnerGroup, Name, OwnerNode, State | sort OwnerGroup | ft -auto

$objs = @()

$csvs = Get-ClusterSharedVolume -cluster $clustername
foreach ( $csv in $csvs )
{
   $csvinfos = $csv | select -Property Name -ExpandProperty SharedVolumeInfo
   foreach ( $csvinfo in $csvinfos )
   {
      $obj = New-Object PSObject -Property @{
         Name        = $csv.Name
         OwnerNode   = $csv.OwnerNode
         Size        = $csvinfo.Partition.Size
         FreeSpace   = $csvinfo.Partition.FreeSpace
         UsedSpace   = $csvinfo.Partition.UsedSpace
         PercentFree = $csvinfo.Partition.PercentFree
      }
      $objs += $obj
   }
}

$storage = $objs | ft -auto Name,@{ Label = "Size(GB)" ; Expression = { "{0:N2}" -f ($_.Size/1024/1024/1024) } },@{ Label = "FreeSpace(GB)" ; Expression = { "{0:N2}" -f ($_.FreeSpace/1024/1024/1024) } },@{ Label = "UsedSpace(GB)" ; Expression = { "{0:N2}" -f ($_.UsedSpace/1024/1024/1024) } },@{ Label = "PercentFree" ; Expression = { "{0:N2}" -f ($_.PercentFree) }}, OwnerNode
$results = ($resources + $storage)
$results

Thanks


Viewing all articles
Browse latest Browse all 21975

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>