Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
# Ping-Forever.ps1
# Modified version of alexinnes/ConstantPingToServer.ps1 (
[string]$LogDirectory = 'C:\ping logs\'
# File name based on date
$FileName = '{0:dd-MM-yyyy}.log' -f (Get-Date)
$FilePath = Join-Path -Path $LogDirectory -ChildPath $FileName
# If the directory doesn't exist, create it.
if (-not(Test-Path $LogDirectory)) {
New-Item -ItemType Directory -Path $LogDirectory
# Ping it!
do {
Test-Connection @PSBoundParameters | Out-File $FilePath -Append -Force -Encoding default
} while ($true)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.