Ping Result


hi,

i relatively new powershell scripting. forgive me if ask questions may simple.

with being said, thank in advance helping me.

i when click button[wpfpingbtn1], ping 8.8.8.8 , on wpfping results, show success or failed.

below code, let me know did wrong. thank you

$wpfpingbtn1.add_click({
    $ipaddress = 8.8.8.8
    $result = ping $ipaddress | fl |out-string;

#if/else result

    if ($result.status -eq "success")
    {
    $wpfpingresult.text = "success"
    }

    else
    {
    $wpfpingresult.text = "failed"
    }

})


$wpfpingbtn1.add_click({ 	if(test-connection 8.8.8.8 -quiet -count 1){ 		$wpfpingresult.text = "success" 	}else{ 		$wpfpingresult.text = "failed" 	} }) 


\_(ツ)_/



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

2008 Windows Deployment Server Properties Error

Can no longer user MS Update - Files required to use Microsoft Update are no longer registered

How do a find data in one file, search for it in another file and if not found, write a custom message to another file