powershell - 将输出转换为 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 文件。它只是返回一个空白页。我可以在屏幕上看到结果,但我想要一份报告。
解决方案
推荐阅读
- sql-server - 从同一个表中的两个日期范围获取数据 (MSSQL)
- python - python中的有限差分方法
- python - 如何使用 sklearn 和 numpy 获得预测的标签?
- c++ - 这个返回元素位置的基于循环的函数有什么问题?
- c# - 无法使用服务帐户通过 SMTP mailkit 和 Gmail API 发送消息
- encryption - base64 解码的字符串给出了奇怪的字符
- php - PHP DateInterval 创建分秒(微秒或毫秒)间隔
- java - 无法从 POST 请求返回数据/响应
- makefile - 为什么Makefile不执行别名语句
- java - 在 exo1.Batiment 类中找不到主方法,请将主方法定义为:public static void main(String[] args) 或 JavaFX 应用程序类