i am trying to write a powershell script that checks connectivity thru a continuous ping, if the ping is unsuccessful the script should start a process and when a window is opened have the script click on a specific button, i have done my research and have not found much help other than this
but this is dependant on Actions having schortcuts that's why it doesn't work for me, i would like to know if it's even possible to do this using powershell before i procced with my work. this is my script so far.
$IP = "192.X.X.X"
$TimeOut = 500
$FailureThreshold = 10
$Ping = New-Object System.Net.NetworkInformation.Ping
Do {
$Result = $Ping.Send($IP,$Timeout)
if ($Result.Status -eq "Success") {
Write-Output "Working as intended."
Exit 0
}
else {
Write-Output "Ping Failed!"
$Failures += 1
}
} until ($Failures -ge $FailureThreshold)
Write-Output "Main DHCP is Down, Starting Backup DHCP Server..."
start-process "C:\Users\XXXX\Desktop\DHCP\dhcpsrv2.5.2\dhcpsrv.exe"
everything works great, i just need to get that button clicked.
and here is a photo of the window that pops up and the button that needs to be clicked.
