首页 > 解决方案 > 将输出转换为 HTML 会创建一个空白页面

问题描述

foreach ($computer in $PingCompList){
    if ($computer.STATUS -eq "Responding") 
    {
        invoke-command -AsJob -ComputerName $computer.Address {wuauclt.exe /detectnow}
        invoke-command -AsJob -ComputerName $computer.Address {wuauclt.exe /reportnow}
        write-host -foregroundcolor "Green" "WSUS is now checking in for computer: " + $computer.Address | ConvertTo-Html -Property Id,Name,PSJobTypeName,State,HasMoreData,Location,Command | Out-File -FilePath c:\temp\completed.html
    }
    else{
        Write-host -foregroundcolor "Red" $computer.Address + "is offline" | ConvertTo-Html -Property Id,Name,PSJobTypeName,State,HasMoreData,Location,Command | Out-File -FilePath c:\temp\failed.html
    }   
} 

我看不到将其输出到 HTML 文件。它只是返回一个空白页。我可以在屏幕上看到结果,但我想要一份报告。

在此处输入图像描述

标签: powershell

解决方案


推荐阅读