-->
10 Powershell Cmdlets To Speed Network Troubleshooting - Techrepublic

10 Powershell Cmdlets To Speed Network Troubleshooting - Techrepublic

10 Powershell Cmdlets To Speed Network Troubleshooting - Techrepublic

https://www.techrepublic.com/article/10-powershell-commands-for-network-troubleshooting/

As Microsoft releases newer versions of its Windows customer too server OSes, it continues to double downwards on PowerShell (PS), the framework developed for managing systems too automation. With its ever-expanding listing of commands, called cmdlets, PS is poised to assist inwards configuring only close whatsoever settings institute inside Windows.

While PS boasts a vast number of cmdlets, thankfully most are grouped based on functionality or the service they manage. For the purposes of this article, the cmdlets that pertain to managing network-based settings are all institute inside the base of operations PowerShell framework.

SEE: Windows administrator's PowerShell script kit (Tech Pro Research)

Before diving into the cmdlets, in that place are a few requirements that must survive met to ensure that all cmdlets are available too fully supported:

  • PC amongst Windows Vista installed (or newer)
  • Windows Management Framework 3.0 (or newer)
  • Switched network (required for most cmdlets to role properly)
  • Broadband meshing access (optional, but recommended)

1. Ping devices locally or remotely

Test-NetConnection -ComputerName "Hostname or IP"

The Test-NetConnection cmdlet offers a number of ways to exam network connectivity on the LAN too WAN. Enter the ascendency every bit typed to a higher house too the estimator volition essentially perform a ping to create upward one's remove heed if network connectivity betwixt the local device too the target estimator or domain exists.

2. Check connectivity based on port or service

Test-NetConnection "Hostname" -Port #

Another characteristic of the Test-NetConnection cmdlet is the might to exam the connectivity betwixt the local device too the target host past times specifying a port number. This is extremely useful for testing services betwixt devices too the ports they communicate on specifically.

3. Trace route communications

Test-NetConnection "Hostname" -traceroute

Privileged Access Management that fits your bandwidth, your budget too your business. Thycotic gives yous the PAM Cloud functionality, flexibility too repose of utilization yous desire too expect: Skip the professional person services too weeks of installation....

White Papers provided by Thycotic

Performing a delineate route to create upward one's remove heed how many hops (or steps) a bundle must larn through to larn from the rootage to its goal is an of import tool, every bit it allows yous to encounter where the transmission is going, too to a greater extent than important, whether it was successful. If it wasn't, delineate route volition bespeak where the bundle failed along the path.

SEE: IT pro's guide to saving fourth dimension amongst PowerShell (free TechRepublic PDF)

4. Obtain IP configuration details

Get-NetIPConfiguration

Similar to the ipconfig command, the Get-NetIPConfiguration cmdlet provides a holistic persuasion of the network configuration(s) onrush the network adapters of a computer. IP, DNS, too Gateway addresses are displayed too sorted past times adapter name.

5. Perform DNS lookups

Resolve-DnsName -Name "Hostname"

Arguably, the backbone of a network is the DNS service. Without it, users would survive forced to know the IP addresses for all websites too services. And even thus when connectivity issues arise, DNS is oftentimes the culprit later on ruling out IP-related errors. By appending the "-server" switch, followed past times a DNS server's IP address, information technology tin perform a DNS resolve asking against a specific server to verify resolution is working properly.

6. View electrical flow TCP connections

Get-NetTCPConnection

Just similar netstat earlier it, the Get-NetTCPConnection cmdlet allows for viewing of the electrical flow TCP connections that bring been made to/from a device, every bit good every bit opened upward or listening connections. This helps yous troubleshoot issues that pertain to IPs too ports, specifically those saltation to sure network services.

7. View & Set DNS information

Get-DnsClient
Set-DnsClientServer Address

This cmdlet lets yous banking venture check the DNS customer data for a device. It volition bespeak what DNS server(s) are beingness used past times the device to perform address resolutions every bit configured on multiple adapters. The Set-DnsClientServerAddress cmdlet allows for specified DNS servers to survive added to the network configuration.

8. Flush DNS cache

Clear-DnsClientCache

The DNS cache helps hold oftentimes used DNS resolution records stored locally on a device, allowing it to read that tape instead of performing a lookup every fourth dimension a tape is requested. This helps speed upward the already fast resolution process. If stale records—or those that haven't been updated—are present, this could atomic number 82 to misfortunate network performance, denial of service, or safety issues that attempt to exploit wrong records that dot user requests to the wrong server/service.

9. Release too renew DHCP leases

Invoke-Command -ComputerName -ScriptBlock {ipconfig /release}
Invoke-Command -ComputerName -ScriptBlock {ipconfig /renew}

While PowerShell includes many cmdlets to cope network settings, in that place is no straight means to release/renew DHCP leases without referencing about other cmdlet first, too then pipage the results to a minute or tertiary cmdlet to survive able to alteration the DHCP setting. However, past times leveraging the Invoke-Command, yous tin remotely (or via script) perform a release and/or renew past times calling upon the ipconfig command.

10. Disable too enable network adapters

Disable-NetAdapter -Name "Adapter Name"
Enable-NetAdapter -Name "Adapter Name"

Last but sure non to the lowest degree is the cmdlet for disabling/enabling network adapters on a device. While non every bit fancy a method for troubleshooting network problems every bit the cmdlets listed above, every bit whatsoever information technology professional person volition country you, sometimes the exclusively matter yous bring to produce to resolve a network-based work is plough it off too on again.


Blogger
Disqus
Pilih Sistem Komentar

No comments

Advertiser