Last active
August 29, 2015 14:21
-
-
Save alexinnes/b2076c88700020af3963 to your computer and use it in GitHub Desktop.
Pings server constantly and logs results.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# 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