This cmdlet is part of the Vexasoft Cmdlet Library. You can download it now or click here to find out more.

Ping-Subnet

Synopsis

Pings all hosts on a specified subnet and returns response information from each host.

Syntax

  • Ping-Subnet [-Subnet] [-Mask] [-Timeout]

Description

The Ping-Subnet cmdlet sends a ping request to each host on a subnet specified by the user and returns the results. The ping requests are sent sequentially with a default timeout of 200 milliseconds.

Parameters

  • Subnet Ping all hosts on this subnet. Parameter will accept any IP address on the subnet.
  • Mask The subnet mask for the specified subnet in dotted decimal format, such as 255.255.255.0.
  • Timeout The timeout for each ping request in milliseconds. The default is 200. Valid values are 1 to 3500.

Inputs

Ping-Subnet does not accept any inputs from the pipeline.

Outputs

Ping-Subnet outputs an array of Vexasoft.PingResponse objects, each representing the status of a pinged address.

Notes

The Ping-Subnet cmdlet requires that DNS services are available to resolve host names.

Example 1

This command will ping all IP addresses on the 192.168.0.0 subnet and return status information for each. The default timeout of 200 milliseconds will be used:

Ping-Subnet -Subnet 192.168.0.0 -Mask 255.255.255.0

Example 2

As with the above example, this command will ping all IP addresses on the 192.168.0.0 subnet, despite the fact that a host address has been given as the subnet address. You can specify either the base address of a subnet or a host within that subnet when using this cmdlet. All ping requests will still be made via your local computer. This cmdlet does not support pinging from remote computers at this time:

Ping-Subnet -Subnet 192.168.0.55 -Mask 255.255.255.0

Example 3

This command will ping all IP addresses on the 192.168.0.0 subnet using the maximum timeout of 3500 milliseconds:

Ping-Subnet -Subnet 192.168.0.0 -Mask 255.255.255.0 -Timeout 3500