$output = @'
| ComputerName | Length |
'@
foreach ($i in gc comps.txt)
{
if (Test-Connection $i -Quiet -Count 2)
{
switch((gi "\\$i\C$\1\1.txt").length / 1mb)
{
{$_ -gt 0 -and $_ -le 2} {$output+="| $i | $_ |
";break}
{$_ -gt 2 -and $_ -le 4} {$output+="| $i | $_ |
";break}
{$_ -gt 4 } { $output+="| $i | $_ |
";break}
default {$output+= "| $i | файл не найден |
"}
}
}
else {$output+= "| $i - не отвечает | файл не найден |
"}
}
$output += @'
'@
$output | Out-File Result.html