Sends ICMP echo request packets ("pings") to one or more computers.
The Test-Connection cmdlet sends Internet Control Message Protocol (ICMP) echo request packets ("pings") to one or more remote computers and returns the echo response replies. You can use this cmdlet to determine whether a particular computer can be contacted across an Internet Protocol (IP) network.
You can use the parameters of Test-Connection to specify both the sending and receiving computers, to run the command as a background job, to set a timeout and number of pings, and to configure the connection and authentication.
Unlike the traditional "ping" command, Test-Connection returns a Win32_PingStatus object that you can investigate in Windows PowerShell, but you can use the Quiet parameter to force it to return only a Boolean value.
-AsJob
Runs the command as a background job.
Note: To use this parameter, the local and remote computers must be configured for remoting and, on Windows Vista and later versions of Windows, you must open Windows PowerShell with the "Run as administrator" option. For more information, see about_Remote_Requirements.
When you use the AsJob parameter, the command immediately returns an object that represents the background job. You can continue to work in the session while the job completes. The job is created on the local computer and the results from remote computers are automatically returned to the local computer. To get the job results, use the Receive-Job cmdlet.
For more information about Windows PowerShell background jobs, see about_Jobs and about_Remote_Jobs.
|
Required?
|
false
|
|
Position?
|
named
|
|
Default Value
|
False
|
|
Accept Pipeline Input?
|
false
|
|
Accept Wildcard Characters?
|
false
|
-Authentication <AuthenticationLevel>
Specifies the authentication level that is used for the WMI connection. (Test-Connection uses WMI.)
Valid values are:
Unchanged: The authentication level is the same as the previous command.
Default: Windows Authentication.
None: No COM authentication.
Connect: Connect-level COM authentication.
Call: Call-level COM authentication.
Packet: Packet-level COM authentication.
PacketIntegrity: Packet Integrity-level COM authentication.
PacketPrivacy: Packet Privacy-level COM authentication.
|
Required?
|
false
|
|
Position?
|
named
|
|
Default Value
|
4
|
|
Accept Pipeline Input?
|
false
|
|
Accept Wildcard Characters?
|
false
|
-BufferSize <int>
Specifies the size, in bytes, of the buffer sent with this command. The default value is 32.
|
Required?
|
false
|
|
Position?
|
named
|
|
Default Value
|
32
|
|
Accept Pipeline Input?
|
false
|
|
Accept Wildcard Characters?
|
false
|
-ComputerName <string[]>
Specifies the computers to ping. Type the computer names or type IP addresses in IPv4 or IPv6 format. Wildcard characters are not permitted. This parameter is required.
This parameter does not rely on Windows PowerShell remoting. You can use the ComputerName parameter even if your computer is not configured to run remote commands.
|
Required?
|
true
|
|
Position?
|
1
|
|
Default Value
|
|
|
Accept Pipeline Input?
|
true (ByPropertyName)
|
|
Accept Wildcard Characters?
|
false
|
-Count <int>
Specifies the number of echo requests to send. The default value is 4.
|
Required?
|
false
|
|
Position?
|
named
|
|
Default Value
|
4
|
|
Accept Pipeline Input?
|
false
|
|
Accept Wildcard Characters?
|
false
|
-Credential <PSCredential>
Specifies a user account that has permission to send a ping request from the source computer. Type a user name, such as "User01" or "Domain01\User01", or enter a PSCredential object, such as one from the Get-Credential cmdlet.
The Credential parameter is valid only when the Source parameter is used in the command. The credentials do not affect the destination computer.
|
Required?
|
false
|
|
Position?
|
named
|
|
Default Value
|
Current user
|
|
Accept Pipeline Input?
|
false
|
|
Accept Wildcard Characters?
|
false
|
-Delay <int>
Specifies the interval between pings, in seconds.
|
Required?
|
false
|
|
Position?
|
named
|
|
Default Value
|
1 (second)
|
|
Accept Pipeline Input?
|
false
|
|
Accept Wildcard Characters?
|
false
|
-Impersonation <ImpersonationLevel>
Specifies the impersonation level to use when calling WMI. (Test-Connection uses WMI.) The default value is "Impersonate".
Valid values are:
Default: Default impersonation.
Anonymous: Hides the identity of the caller.
Identify: Allows objects to query the credentials of the caller.
Impersonate: Allows objects to use the credentials of the caller.
|
Required?
|
false
|
|
Position?
|
named
|
|
Default Value
|
3
|
|
Accept Pipeline Input?
|
false
|
|
Accept Wildcard Characters?
|
false
|
-Quiet
Suppresses all errors and returns $True if any pings succeeded and $False if all failed.
|
Required?
|
false
|
|
Position?
|
named
|
|
Default Value
|
False
|
|
Accept Pipeline Input?
|
false
|
|
Accept Wildcard Characters?
|
false
|
-Source <string[]>
Specifies the names of the computers where the ping originates. Enter a comma-separated list of computer names. The default is the local computer.
|
Required?
|
false
|
|
Position?
|
2
|
|
Default Value
|
Local computer
|
|
Accept Pipeline Input?
|
false
|
|
Accept Wildcard Characters?
|
false
|
-ThrottleLimit <int>
Specifies the maximum number of concurrent connections that can be established to run this command. If you omit this parameter or enter a value of 0, the default value, 32, is used.
The throttle limit applies only to the current command, not to the session or to the computer.
|
Required?
|
false
|
|
Position?
|
named
|
|
Default Value
|
32
|
|
Accept Pipeline Input?
|
false
|
|
Accept Wildcard Characters?
|
false
|
-TimeToLive <int>
Specifies the maximum time, in seconds, that each echo request packet ("pings") is active. Enter an integer between 1 and 255. The default value is 80 (seconds). The alias of the TimeToLive parameter is TTL.
|
Required?
|
false
|
|
Position?
|
named
|
|
Default Value
|
80
|
|
Accept Pipeline Input?
|
false
|
|
Accept Wildcard Characters?
|
false
|
<CommonParameters>
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, -OutVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.