Powershell version 4 and Windows 8.1 / 2012 R2 introduced the Test-NetConnection command as a tool for performing network connectivity tests with Powershell.Test-NetConnection allows you to perform ping, traceroute and TCP port tests and from Windows 10 and Server 2016 onward introduces the ability to do 'Diagnose Routing' tests with the same cmdlet. 64 bytes from 127.0.0.1: icmpseq=1 ttl=64 time=0.063 ms 64 bytes from 127.0.0.1: icmpseq=2 ttl=64 time=0.060 ms 64 bytes from 127.0.0.1: icmpseq=3 ttl=64 time=0.055 ms 64 bytes from 127.0.0.1: icmpseq=4 ttl=64 time=0.061 ms - 0 ping statistics - 4 packets transmitted, 4 received, 0% packet loss, time 2997ms rtt min/avg/max/mdev = 0.055.
As you already know, ping command is used to find out whether the peer host/gateway is reachable.
If you are thinking ping is such a simple command and why do I need 15 examples, you should read the rest of the article.
Ping command provides lot more options than what you might already know.
Ping Example 1. Increase or Decrease the Time Interval Between Packets
By default ping waits for 1 second before sending the next packet. You can increase or decrease this using option -i as shown below.
Increase Ping Time Interval
Example: Wait for 5 seconds before sending the next packet.
Decrease Ping Time Interval
Example: Wait 0.1 seconds before sending the next packet.
Note: Only super user can specify interval less than 0.2 seconds. If not, you’ll get the following error message.
Ping Example 2. Check whether the local network interface is up and running
Before checking whether the peer machine is reachable, first check whether the local network network is up and running using any one of the following 3 methods.
Ping localhost using zero (0)
This is probably the easiest and simplest way to ping a local host
Ping localhost using name
Ping localhost using ip
To quit the ping command, send SIGINT signal by pressing CTRL+C. If you have not specified any option to make the ping to exit automatically, then you will be terminating using CTRL+C ( SIGINT ) which will show the statistics and then terminate the ping process. When everything is working properly, it should say ‘0% packet loss’
Ping Example 3. Send N packets and stop
Send N packets specified with -c option and then stop. This way the ping command can exit automatically instead of pressing CTRL+C to exit.
In the following example, ping command sends 5 packets, and waits for response from the destination host. Ping will exit after receiving the response or error.
Ping Example 4. Show Version and Exit
Display the current version of ping program using -V option.
Ping Example 5. Flood the network
Super users can send hundred or more packets per second using -f option. It prints a ‘.’ when a packet is sent, and a backspace is printed when a packet is received.
As shown below, ping -f has sent more than 400,000 packets in few seconds.
Ping Example 6. Audible ping: Give beep when the peer is reachable
This option is useful for sysadmin during troubleshooting. There is no need for you to look at the ping output after each and every change. You can continue working with your changes, and when the remote machine become reachable you’ll hear the beep automatically.
Ttl Script Examples Resumes
Note: It can give beep only from terminal number 1 through 7 and gnome-terminal ( It will not work in console ).
Ping Example 7. Find out the IP address
You can identify the ip-address using the host name as shown below.
Ping Example 8. Print Only Ping Command Summary Statistics
Use option -q to view only the ping statistics summary as shown below.
Ping Example 9. Change Ping Packet Size
You can change the packet size of ping command using -s option.
Example: Change the default packet size from 56 to 100.
Ttl Script Examples
Ping Packet Size
In the above example, when we set the packet size to 100, it displays ‘128 bytes’ in the output. This is because of the Ping packet header size, which is 28 bytes. So, if you specify the packet size as 100, 28 bytes for header will be added to it and 128 bytes will be sent.
Ping Bytes Sent = Ping Packet Size + Ping Header Packet Size (28 bytes)
Ping Example 10. Timeout -w
Ping -w option specifies the deadline to terminate the ping output. This specifies the total number of seconds the ping command should send packets to the remote host.
The following example will ping for 5 seconds. i.e ping command will exit after 5 seconds irrespective of how many packets are sent or received.
Note: When you specify both -w, and -c, whichever comes first will terminate the ping command.
Ping Example 11. Online ping
Ping from different locations and check the reachability (availability or time for reaching) of your server from different locations.
If you want to do an online ping, try just ping.
Ping Example 12. Option -w or -c Exits Ping
Ping Example 13. Shorter statistics with SIGQUIT
While ping is printing the individual packet status, when you want to view the shorter statistics you can use this technique.
Pressing CTRL+| (Control key followed by pipe symbol) for the shows the summary in between, and continues with it packet sending and receiving process.
Ping Example 14. Specify path for ping to send the packet
You can also specify through which path the ping should send the packet to destination.
Teraterm Script Commands
Note: If one of the hop in the path is not reachable then you will have failure in pinging.
Ping Example 15. Record and print route of how ECHO_REQUEST sent and ECHO_REPLY received
It records, and prints the network route through which the packet is sent and received. This is useful for network engineers who wish to know how the packet is sent and received.
If you enjoyed this article, you might also like..
Next post: 4 Ways to Kill a Process – kill, killall, pkill, xkill
Previous post: Black Friday Deal: 40% Discount on Vim 101 Hacks Book
-->Syntax
Description
The Set-DnsServerResourceRecord cmdlet changes a resource record object located in a Domain Name System (DNS) zone.You can use the OldInputObject parameter to specify a resource record object that you want to change and NewInputObject to specify a new resource record.This cmdlet cannot change the Name or Type of a DNS server resource record object.
Examples
Example 1: Change the timespan of a resource record
In this example, the time to live (TTL) value of the resource record named Host01 in the zone named contoso.com is changed to 2 hours.
The first command assigns a resource record named Host01 in the zone named contoso.com to the variable $OldObj.
The second command copies the variable $OldObj to a new variable $NewObj using the .Clone() method.
The third command sets the TTL time span for $NewObj to 2 hours.
The fourth command changes the properties of $OldObj to the settings specified for $NewObj in the previous command.
Parameters
Runs the cmdlet as a background job. Use this parameter to run commands that take a long time to complete.
The cmdlet immediately returns an object that represents the job and then displays the command prompt.You can continue to work in the session while the job completes.To manage the job, use the *-Job
cmdlets.To get the job results, use the Receive-Job cmdlet.
For more information about Windows PowerShell background jobs, see about_Jobs.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Runs the cmdlet in a remote session or on a remote computer.Enter a computer name or a session object, such as the output of a New-CimSession or Get-CimSession cmdlet.The default is the current session on the local computer.
Type: | CimSession[] |
Aliases: | Session |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Specifies a DNS server.If you do not specify this parameter, the command runs on the local system.You can specify an IP address or any value that resolves to an IP address, such as a fully qualified domain name (FQDN), host name, or NETBIOS name.
Type: | String |
Aliases: | Cn, ForwardLookupPrimaryServer |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Prompts you for confirmation before running the cmdlet.
Type: | SwitchParameter |
Aliases: | cf |
Position: | Named |
Default value: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Specifies a DNS server resource record object to overwrite the OldInputObject parameter value.
Type: | CimInstance |
Position: | 3 |
Default value: | None |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Specifies a DNS server resource record object.
Type: | CimInstance |
Position: | 2 |
Default value: | None |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Returns an object representing the item with which you are working.By default, this cmdlet does not generate any output.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Teraterm Ttl Manual
Specifies the maximum number of concurrent operations that can be established to run the cmdlet.If this parameter is omitted or a value of 0
is entered, then Windows PowerShell® calculates an optimum throttle limit for the cmdlet based on the number of CIM cmdlets that are running on the computer.The throttle limit applies only to the current cmdlet, not to the session or to the computer.
Type: | Int32 |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Specifies the virtualization instance in which the zone will be added.A virtualization instance is logical partition in a DNS Server, which is capable of independently hosting zones and zone scopes.Same name zones and zone scopes can be hosted in different virtualization instances.This parameter is optional and if not provided it will add the zone into the default virtualization instance which is functionally equivalent to a standard DNS server.
Tera Term Language Commands
Type: | String |
Position: | Named |
Default value: | None |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Shows what would happen if the cmdlet runs.The cmdlet is not run.
Type: | SwitchParameter |
Aliases: | wi |
Position: | Named |
Default value: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Teraterm Ttl Script Examples
Specifies the name of a DNS zone.
Type: | String |
Aliases: | ForwardLookupZone |
Position: | 1 |
Default value: | None |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Specifies the name of a zone scope.
Type: | String |
Position: | Named |
Default value: | None |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Inputs
Outputs
The Microsoft.Management.Infrastructure.CimInstance
object is a wrapper class that displays Windows Management Instrumentation (WMI) objects.The path after the pound sign (#
) provides the namespace and class name for the underlying WMI object.