Skip to content

Instantly share code, notes, and snippets.

@alexinnes
Last active August 29, 2015 14:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save alexinnes/b2076c88700020af3963 to your computer and use it in GitHub Desktop.
Save alexinnes/b2076c88700020af3963 to your computer and use it in GitHub Desktop.
Pings server constantly and logs results.
#
# ConstantPingToArc.ps1
#
##This script purpose is to ping Arc console to monitor for network dropouts.
#Location for the log file
$testPath = Test-Path "C:\ping logs\"
#Manual on/off switch, if $onOff = $true means the loop is on, $false = its off.
$onOff = $true
$fileName = Get-Date -Format dd-MM-yyyy
$server = "abz-arcp01"
#if the file path is not their then it creates it.
if ($testPath -eq $true){while($onOff -eq $true){Test-Connection abz-arcp01 |Out-File "C:\ping logs\$filename.log" -Append -Force -encoding default}}else
{New-Item -ItemType directory -Path "C:\ping logs\"; while($onOff -eq $true){Test-Connection $server |Out-File "C:\ping logs\$filename.log" -Append -Force -encoding default}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment