Function TestPingAndRDP ($IP)
{
Write-Host ***********************************************************
Write-Host Checking ping
Write-Host ***********************************************************
ping $IP
Write-Host $IP, "PING", ([System.Net.NetworkInformation.Ping]::new().Send($IP)).Status
Write-Host ***********************************************************
Write-Host Checking RDP
Write-Host ***********************************************************
Test-NetConnection -ComputerName $IP -CommonTCPport rdp
Write-Host ***********************************************************
}
Function PingOnly ($IPING)
{
Write-Host ***********************************************************
Write-Host Checking ping ONLY
Write-Host ***********************************************************
ping $IPING
Write-Host $IPING, "PING", ([System.Net.NetworkInformation.Ping]::new().Send($IPING)).Status
Write-Host ***********************************************************
}
Function TestWeb ($IWEB)
{
Write-Host ***********************************************************
Write-Host Checking web port 80
Write-Host ***********************************************************
Test-NetConnection -ComputerName $IWEB -CommonTCPport http
Write-Host ***********************************************************
Write-Host Checking web port 443
Write-Host ***********************************************************
Test-NetConnection -ComputerName $IWEB -Port 443
Write-Host ***********************************************************
}
Function TestHTTPCode ($url)
{
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$date = Get-Date
Write-Host $url, "HTTP STATUS CODE" (Invoke-WebRequest -uri $url).StatusCode, $date
}
###############################
# Remove comment by removing the #, then the code will be run
###############################
#TestPingAndRDP 192.168.100.10
#PingOnly 192.168.100.50
#PingOnly 8.8.8.8
#PingOnly www.google.com
#TestWeb www.google.com
#TestHTTPCode www.google.com