Thanks for pointing that out i missed to change that. but still i am getting the error.
FYI this is my whole piece of code
[CmdletBinding()]
param(
[Parameter(Mandatory=$True,
ValueFromPipeline=$True,
ValueFromPipelineByPropertyName=$True)]
[String]$ComputerName,
[Parameter(Mandatory=$True)]
[String]$Path
)
BEGIN{
Import-Module EnhancedHTML2
}
Process{
$Style =@"
body{
color:#333333;
font-family:calibri,Tahoma;
font-size : 10pt;
}
h1{
text-align:center;
}
h2{
border-top:1px solid #666666;
}
th{
font-weight:bold;
color:#eeeeee;
background-color:#333333
cursor:pointer;
}
.odd {background-color:#ffffff;}
.even {background-color:#dddddd;}
.paginate_enabled_next, .paginate_enabled_previous
{
cursor:pointer;
border:1px solid #222222;
background-color:#dddddd;
padding:2px;
margin:4px;
border-radius:2px
}
.paginate_disabled_previous, .paginate_disabled_previous
{
color:#666666;
cursor:pointer;
background-color:#dddddd;
padding:2px;
margin:4px;
border-radius:2px
}
.dataTables_info {margin-bottom:4px;}
.sectionheader {cursor:pointer;}
.secrtionheader:hover {color:red;}
.grid {width:100%}
.red{
color:red;
font-weight:bold;
}
"@
function Get-Disk{
[CmdletBinding()]
param(
[Parameter(Mandatory=$True)][String]$ComputerName
)
$DI = Get-WmiObject -Class win32_LogicalDisk -ComputerName $computername
$props = @{ ‘VolumeName’=$DI.Volumename;
‘Name’=$DI.Name;
‘Size’=“{0:n2}” -f ($DI.size/1GB);
‘AvailableSpace’=“{0:n2}” -f ($DI.freespace/1gb);
‘PercentFree’=“{0:n2}” -f ($DI.freespace/$DI.size*100);}
New-Object -TypeName PSObject -Property $props
}
foreach($computer in $ComputerName){
try{
$reachable = $true
Write-Verbose “Checking Connectivity to $computer”
Get-WmiObject -Class win32_bios -ComputerName $computer -EnableAllPrivileges Stop | Out-Null
}catch{
Write-Warning “$computer connectivity failed”
$reachable = $false
}
if($reachable){
$filepath = Join-Path -Path $Path -ChildPath “$computer.html”
}
$params = @{'As'='Table';
'Precontent'='♦ LocalDisks';
'EvenRowCssClass'='even';
'OddRowCssClass'='odd';
'MakeTableDynamic'=$true;
'TableCssClass'='grid';
'Properties'='VolumeName','Name',
@{n='Size(GB)';e={$_.Size}},
@{n='AvailableSpace(GB)';e={$_.AvailableSpace};css={if($_.Percentfree -lt 80){'red'}}},
@{n='PercentFree(%)';e={$_.PercentFree};css={if($_.Percentfree -lt 80){'red'}}}}
$html_Disk = Get-Disk -ComputerName $computer | ConvertTo-EnhancedHTMLFragment @params
$params = @{'CssStyleSheet'=$Style;
'Title'="Disk Report for $computer";
'PreContent'="Disk Report for $computer"
'HTMLFragments'=@($html_Disk)}
ConvertTo-EnhancedHTML @params | Out-File -FilePath $Path
}
}