FerMelon
FerMelon

Reputation: 93

Equivalent To Test-connection from powershell, on VB.NET

I have this code:

If (Test-Connection $Computer -Quiet) {
    If ($Computer -eq 'localhost') { #Checks to see if system is localhost and gets its actual Computer name.
        $Computer = ls env:Computername
        $Computer = $Computer.Value
    }

And actually there was a really good way to see if the server responded and return a boolean if it did or didn't, which is "Test-Connection $Computer -Quiet"

Is there some simple solution to this for VB.NET?

Thanks!

Upvotes: 0

Views: 529

Answers (1)

Richard
Richard

Reputation: 109035

You could make use of System.Net.NetworkInformation.Ping.

Upvotes: 1

Related Questions