##
$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
you can use following code: $Ping = (Get-WmiObject -Query "Select StatusCode
from Win32_PingStatus where address = 'hostname'")
Martin
"proxb" <boe...@gmail.com> wrote in message
news:4c685174-1727-4de3...@b15g2000yqd.googlegroups.com...
__GENUS : 2
__CLASS : Win32_PingStatus
__SUPERCLASS :
__DYNASTY :
__RELPATH :
__PROPERTY_COUNT : 1
__DERIVATION : {}
__SERVER :
__NAMESPACE :
__PATH :
StatusCode : 11050
On Nov 8, 8:04 am, "Martin Zugec" <martin.zu...@gmail.com> wrote:
> Hi Boe,
>
> you can use following code: $Ping = (Get-WmiObject -Query "Select StatusCode
> from Win32_PingStatus where address = 'hostname'")
>
> Martin
>
> "proxb" <boep...@gmail.com> wrote in message
Martin
"proxb" <boe...@gmail.com> wrote in message
news:c31cfb6d-b74a-4e61...@b15g2000yqd.googlegroups.com...
On Nov 9, 1:57 am, "Martin Zugec" <martin.zu...@gmail.com> wrote:
> And if you run ping.exe, do you get IPv4 or IPv6? ;)
>
> Martin
>
> >> > Boe- Hide quoted text -
>
> - Show quoted text -
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:
> .
>
Try doing an NSLookup (against your host name)
and see what comes back...(just curious before I
would get to deep in troubleshooting.)
"RichS [MVP]" <Rich...@discussions.microsoft.com> wrote in message
news:47392F7F-2180-4D26...@microsoft.com...