Have you tried putting the IP address in and see if it works
I did this
PS> $ping = New-Object -TypeName System.Net.NetworkInformation.Ping
PS> $reply = $ping.Send("127.0.0.1")
PS> $reply
Status : Success
Address : 127.0.0.1
RoundtripTime : 0
Options : System.Net.NetworkInformation.PingOptions
Buffer : {97, 98, 99, 100...}
which suggests it works on IP4 OK
I couldn't find an option to set IP 4 or IP6
--
Richard Siddaway
All scripts are supplied "as is" and with no warranty
PowerShell MVP
Blog:
http://richardsiddaway.spaces.live.com/
PowerShell User Group:
http://www.get-psuguk.org.uk
"proxb" wrote:
> I am having problems with my code working. For whatever reason it
> tries to ping a hostname, it tries pinging an ipv6 address instead of
> the ipv4 address, which is returning a status code of 11050 (General
> Failure). Below is the relevant code. Anyone have an idea on how to
> make it ping ipv4 instead of ipv6?
>
> ##
> $ping = new-object System.Net.NetworkInformation.Ping
> $reply = $ping.send("hostname")
> Write-host "Ping code: $reply.status"
>
> Ping code: 11050
> ##
>
> I would imagine that there is a way to tell it what version of ip to
> look at, much like you can while in the command prompt: ping hostname
> -4 or ping hostname -6
>
> Thanks for any help with this.
>
> Boe
> .
>