|
ping results to html file I have a list of servers in my MachineList.txt file.
I want to get the result of this script to go to html file.
The idea is to have a ping monitoring html file, where pinging servers are
displayed green and not pinging servers are displayed red.
Here is my script:
Clear
$PingMachines = Gc "C:\MachineList.txt"
ForEach($MachineName In $PingMachines)
{$PingStatus = Gwmi Win32_PingStatus -Filter "Address = '$MachineName'" |
Select-Object StatusCode
If ($PingStatus.StatusCode -eq 0)
{Write-Host $MachineName -Fore "Green"}
Else
{Write-Host $MachineName -Fore "Red"}}
Could i implement something like this somewhere in the script?:
{$MachineName | Convertto-Html > C:\PingResults.htm}}
Ho would the correct script look like? |