我编写了一个脚本来检查每个服务器的 nslookup 并将详细信息导出到 Excel
请帮助我如何在 Excel 输出中为特定文本添加颜色
代码
$result = foreach($Server in $Servers) {
$addresses = try {
[System.Net.Dns]::GetHostAddresses($Server).IPAddressToString
}
catch {
"Server IP cannot resolve"
}
foreach($address in $addresses) {
[pscustomobject]@{
Server = $Server
IPAddress = $address
}
}
}
$result | Export-Excel ....