SlideShare a Scribd company logo
1 of 23
Windows PowerShell
Introduction to Network Configuration and Troubleshooting using
PowerShell
Introduction
• PowerShell is a command-line shell and scripting language that seeks to help admins configure systems and automate
tasks.
• The object-oriented technology is built on Microsoft's .NET framework.
• As such, it lets IT personnel work with objects in contrast with text-based shells.
• Windows PowerShell has revolutionized the Windows command line.
• From configuration management to software installation to scripting, PowerShell is one of the most
powerful tools in any Windows administrator's toolbox.
• And PowerShell is also useful for managing Windows network settings and services.
What is PowerShell used for?
• PowerShell, in its role as command-line shell, serves as the replacement for Microsoft's Command
Prompt, which goes back to the days of DOS.
• Microsoft made PowerShell the default command-line interface (CLI) for Windows 10 as of build
14791. Most users first interact with PowerShell in its command-line capacity.
• The key use case for PowerShell is automating various administrative activities.
• Examples include navigating registries, identifying processes using the most memory and
stopping/restarting a particular service.
• PowerShell can also obtain model information on a computer and extract information on OSes,
such as the specific version and service pack levels.
• In addition, admins can use PowerShell to run commands and scripts on one or more remote
computers, using protocols such as WS-Management and, more recently, Secure Shell (SSH).
• PowerShell is used in IT departments to automate formerly manual tasks, with the objective of
boosting efficiency.
• Third-party IT services firms, such as managed service providers (MSPs), also use PowerShell.
• MSPs tap PowerShell to automate such tasks as software deployment, software integration
and report generation.
• Service providers also create PowerShell scripts to periodically check on whether customers
have required software installed and to automate the process of creating a new user account.
Powershell commands - Cmdlets
• Cmdlets are the foundational component of PowerShell automation. A cmdlet performs a
single function and returns a .NET object.
• Cmdlets are typically structured in a verb-noun format.
• One or more parameters can be added to a cmdlet to make the command more specific --
directing a cmdlet to install a particular version of a software product, for example.
• Ready-made cmdlets abound, and admins can learn about them through help content, which
describes the cmdlet and its parameters.
• Admins can create their own cmdlets using PowerShell script or C#.
• All told, thousands of cmdlets exist across PowerShell and public and private repositories.
Examples
• Here are some of the basic cmdlets included in PowerShell.
Cmdlets vs. commands
• Cmdlets attempt to make it clear to the user what action they perform. That's in contrast to
the sometimes truncated and cryptic command statements used in other shells.
• Joey Aiello, senior program manager, PowerShell, at Microsoft, said PowerShell's "very verbose
syntax" simplifies matters for people who aren't as familiar with the shorter command names
used in shells such as CMD and BASH.
• On the other hand, PowerShell supports aliases for admins that are accustomed to using
shorter commands.
PowerShell Cmdlets
• We will discuss PowerShell cmdlets for network troubleshooting.
• The first group of cmdlets deals with displaying network information so admins can confirm
it is correct.
• The second group covers name resolution, and
• the final set looks at managing network services with PowerShell.
• The basic PowerShell syntax is verb-noun followed by possible parameters.
• For example,
• Get-Date displays the system's current date and time.
• Here are a few PowerShell tricks to remember:
• PowerShell cmdlets are not case-sensitive.
• Use the Format-Table cmdlet to organize output.
• Use the Up arrow key to browse recent commands.
• Use the Tab key after verbs to see what nouns are available -- many options are available.
• Use the Tab key after a parameter dash (-) to see the available parameters.
• Use the Tab key after a parameter to see the valid parameter values.
Get-NetIPAddress
• view IP address settings
• Frequently, the first step in troubleshooting a network problem is confirming the host's IP
address configuration.
• While many admins use ipconfig to display this information, the Get-NetIPAddress cmdlet
serves the same purpose.
Get-NetIPConfiguration
• display IP address details
• Another option is to use the Get-NetIPConfiguration cmdlet to display details about the IP
address settings. One major feature of this cmdlet is its ability to provide more focused
information. Depending on the parameters admins include, the output displays information
for specific interfaces and at varying levels of detail.
Get-NetAdapter
• display network interface settings
• It can be helpful to display specific information about the network card itself rather than the
logical addressing associated with it. Use the Get-NetAdapter cmdlet to see the interface's
attributes, including name, description, interface index, status, media access control address
and link speed.
Enable-NetAdapter and Disable-NetAdapter
• up and down an interface
• Admins may discover another admin has downed a network interface, or perhaps someone
configured the interface as a failover and kept it in the down state. They can use the Enable-
NetAdapter cmdlet to reenable -- or up -- an interface. Downing the interface relies on the
Disable-NetAdapter cmdlet.
Get-NetRoute
• show the routing table
• If admins are confident the system's IP address settings are correct and the network interface
is responsive, they may need to confirm the routing table.
• Rather than using the older route command, try the Get-NetRoute cmdlet instead.
Test-Connection and Test-NetConnection
• test connectivity
• Ping is probably the most ubiquitous network troubleshooting tool.
• PowerShell has its own cmdlet for ping: Test-Connection.
• The syntax and responses are similar to the more generic tool.
Get-NetTCPConnection
• test existing connections to server
• Another connectivity check is viewing existing connections to the server.
• Do this with the Get-NetTCPConnection cmdlet, which replaces the netstat command.
• The output from this command may be long depending on the current connections to the
system and the network services running on it.
• One way to narrow the scope of the results is to request current connections by a specific port
number.
• For example, perhaps admins are interested in results on port 135/TCP. In that case, they can
use the -LocalPort parameter, as seen below.
• PS>Get-NetTCPConnection –LocalPort 135
Resolve-DnsName
• confirm name resolution works
• Begin by attempting to resolve an IP address manually with the Resolve-DnsName cmdlet. This
cmdlet may replace or supplement nslookup in an admin's toolbox.
• PS> Resolve-DnsName google.com
Get-DnsClient
• check DNS client status
• Next, check the status of the DNS client software on the local machine. The Get-DnsClient
cmdlet provides this information, as seen below.
Get-DnsClientCache and Clear-DnsClientCache
• view and clear DNS cache
• When troubleshooting client-side name resolution problems, it's often useful to clear the DNS
cache. While the cache normally makes the name resolution process more efficient, it can
potentially store incorrect or outdated information, causing name resolution to fail or return
false results. Admins often use ipconfig /flushdns to do this, along with ipconfig /displaydns to
view the cache.
Get-DnsClientServerAddress
• display configured DNS servers
• Client computers may attempt to resolve names against invalid DNS servers. Display the
configured DNS servers for a client by using the Get-DnsClientServerAddress cmdlet, as seen
below.
Get-Service
• check service status
• Identify services either by service name or display name. A parameter exists for both options.
For example, check the status of a service by using the Get-Service -Name DhcpServer or Get-
Service -DisplayName "DHCP Server" cmdlet, as shown below.
• PS> Get-Service –Name DhcpServer
Name DisplayName
dhcp DHCP Client
DNS DNS Server
DnsCache DNS Client
TermService Remote Desktop Services
ssh-agent OpenSSH Authentication Agent
Restart-Service
• restart a service
• Restarting a service uses a similar cmdlet and syntax. For example, to restart the DHCP server
service, use the Restart-Service cmdlet with the -Name parameter.

More Related Content

Similar to Windows PowerShell.pptx

Improving Website Performance and Scalability with Memcached
Improving Website Performance and Scalability with MemcachedImproving Website Performance and Scalability with Memcached
Improving Website Performance and Scalability with MemcachedAcquia
 
Improving Website Performance with Memecached Webinar | Achieve Internet
Improving Website Performance with Memecached Webinar | Achieve InternetImproving Website Performance with Memecached Webinar | Achieve Internet
Improving Website Performance with Memecached Webinar | Achieve InternetAchieve Internet
 
Improving Website Performance with Memecached Webinar | Achieve Internet
Improving Website Performance with Memecached Webinar | Achieve InternetImproving Website Performance with Memecached Webinar | Achieve Internet
Improving Website Performance with Memecached Webinar | Achieve InternetAchieve Internet
 
Apache Street Smarts Presentation (SANS 99)
Apache Street Smarts Presentation (SANS 99)Apache Street Smarts Presentation (SANS 99)
Apache Street Smarts Presentation (SANS 99)Michael Dobe, Ph.D.
 
Using MAMP for Web Development
Using MAMP for Web DevelopmentUsing MAMP for Web Development
Using MAMP for Web DevelopmentEric Greene
 
Best And Worst Practices Deploying IBM Connections
Best And Worst Practices Deploying IBM ConnectionsBest And Worst Practices Deploying IBM Connections
Best And Worst Practices Deploying IBM ConnectionsLetsConnect
 
Troubleshooting a XenDesktop Environment using the PowerShell SDK
Troubleshooting a XenDesktop Environment using the PowerShell SDKTroubleshooting a XenDesktop Environment using the PowerShell SDK
Troubleshooting a XenDesktop Environment using the PowerShell SDKDavid McGeough
 
PowerShell Plus v4.7 Overview
PowerShell Plus v4.7 OverviewPowerShell Plus v4.7 Overview
PowerShell Plus v4.7 OverviewRichard Giles
 
A Lap Around PowerShell 3.0
A Lap Around PowerShell 3.0A Lap Around PowerShell 3.0
A Lap Around PowerShell 3.0Sarah Dutkiewicz
 
KACE Agent Architecture and Troubleshooting Overview
KACE Agent Architecture and Troubleshooting OverviewKACE Agent Architecture and Troubleshooting Overview
KACE Agent Architecture and Troubleshooting OverviewDell World
 
Midwest PHP - Scaling Magento
Midwest PHP - Scaling MagentoMidwest PHP - Scaling Magento
Midwest PHP - Scaling MagentoMathew Beane
 
PowerShell for Penetration Testers
PowerShell for Penetration TestersPowerShell for Penetration Testers
PowerShell for Penetration TestersNikhil Mittal
 
Modernizing your database with SQL Server 2019
Modernizing your database with SQL Server 2019Modernizing your database with SQL Server 2019
Modernizing your database with SQL Server 2019Antonios Chatzipavlis
 
8 power shell commands every windows administrator should know
8 power shell commands every windows administrator should know8 power shell commands every windows administrator should know
8 power shell commands every windows administrator should knowDana Pardaz Co.
 
11g Identity Management - InSync10
11g Identity Management - InSync1011g Identity Management - InSync10
11g Identity Management - InSync10Peter McLarty
 
Best Practices for Building WordPress Applications
Best Practices for Building WordPress ApplicationsBest Practices for Building WordPress Applications
Best Practices for Building WordPress ApplicationsTaylor Lovett
 
Power shell for sp admins
Power shell for sp adminsPower shell for sp admins
Power shell for sp adminsRick Taylor
 
SOUG_Deployment__Automation_DB
SOUG_Deployment__Automation_DBSOUG_Deployment__Automation_DB
SOUG_Deployment__Automation_DBUniFabric
 
Phpworld.2015 scaling magento
Phpworld.2015 scaling magentoPhpworld.2015 scaling magento
Phpworld.2015 scaling magentoMathew Beane
 

Similar to Windows PowerShell.pptx (20)

Improving Website Performance and Scalability with Memcached
Improving Website Performance and Scalability with MemcachedImproving Website Performance and Scalability with Memcached
Improving Website Performance and Scalability with Memcached
 
Improving Website Performance with Memecached Webinar | Achieve Internet
Improving Website Performance with Memecached Webinar | Achieve InternetImproving Website Performance with Memecached Webinar | Achieve Internet
Improving Website Performance with Memecached Webinar | Achieve Internet
 
Improving Website Performance with Memecached Webinar | Achieve Internet
Improving Website Performance with Memecached Webinar | Achieve InternetImproving Website Performance with Memecached Webinar | Achieve Internet
Improving Website Performance with Memecached Webinar | Achieve Internet
 
Apache Street Smarts Presentation (SANS 99)
Apache Street Smarts Presentation (SANS 99)Apache Street Smarts Presentation (SANS 99)
Apache Street Smarts Presentation (SANS 99)
 
Using MAMP for Web Development
Using MAMP for Web DevelopmentUsing MAMP for Web Development
Using MAMP for Web Development
 
Demystifying puppet
Demystifying puppetDemystifying puppet
Demystifying puppet
 
Best And Worst Practices Deploying IBM Connections
Best And Worst Practices Deploying IBM ConnectionsBest And Worst Practices Deploying IBM Connections
Best And Worst Practices Deploying IBM Connections
 
Troubleshooting a XenDesktop Environment using the PowerShell SDK
Troubleshooting a XenDesktop Environment using the PowerShell SDKTroubleshooting a XenDesktop Environment using the PowerShell SDK
Troubleshooting a XenDesktop Environment using the PowerShell SDK
 
PowerShell Plus v4.7 Overview
PowerShell Plus v4.7 OverviewPowerShell Plus v4.7 Overview
PowerShell Plus v4.7 Overview
 
A Lap Around PowerShell 3.0
A Lap Around PowerShell 3.0A Lap Around PowerShell 3.0
A Lap Around PowerShell 3.0
 
KACE Agent Architecture and Troubleshooting Overview
KACE Agent Architecture and Troubleshooting OverviewKACE Agent Architecture and Troubleshooting Overview
KACE Agent Architecture and Troubleshooting Overview
 
Midwest PHP - Scaling Magento
Midwest PHP - Scaling MagentoMidwest PHP - Scaling Magento
Midwest PHP - Scaling Magento
 
PowerShell for Penetration Testers
PowerShell for Penetration TestersPowerShell for Penetration Testers
PowerShell for Penetration Testers
 
Modernizing your database with SQL Server 2019
Modernizing your database with SQL Server 2019Modernizing your database with SQL Server 2019
Modernizing your database with SQL Server 2019
 
8 power shell commands every windows administrator should know
8 power shell commands every windows administrator should know8 power shell commands every windows administrator should know
8 power shell commands every windows administrator should know
 
11g Identity Management - InSync10
11g Identity Management - InSync1011g Identity Management - InSync10
11g Identity Management - InSync10
 
Best Practices for Building WordPress Applications
Best Practices for Building WordPress ApplicationsBest Practices for Building WordPress Applications
Best Practices for Building WordPress Applications
 
Power shell for sp admins
Power shell for sp adminsPower shell for sp admins
Power shell for sp admins
 
SOUG_Deployment__Automation_DB
SOUG_Deployment__Automation_DBSOUG_Deployment__Automation_DB
SOUG_Deployment__Automation_DB
 
Phpworld.2015 scaling magento
Phpworld.2015 scaling magentoPhpworld.2015 scaling magento
Phpworld.2015 scaling magento
 

Recently uploaded

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
Third Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxThird Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxAmita Gupta
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
Magic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptxMagic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptxdhanalakshmis0310
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfNirmal Dwivedi
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxnegromaestrong
 

Recently uploaded (20)

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Third Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxThird Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptx
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Magic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptxMagic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptx
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 

Windows PowerShell.pptx

  • 1. Windows PowerShell Introduction to Network Configuration and Troubleshooting using PowerShell
  • 2. Introduction • PowerShell is a command-line shell and scripting language that seeks to help admins configure systems and automate tasks. • The object-oriented technology is built on Microsoft's .NET framework. • As such, it lets IT personnel work with objects in contrast with text-based shells. • Windows PowerShell has revolutionized the Windows command line. • From configuration management to software installation to scripting, PowerShell is one of the most powerful tools in any Windows administrator's toolbox. • And PowerShell is also useful for managing Windows network settings and services.
  • 3. What is PowerShell used for? • PowerShell, in its role as command-line shell, serves as the replacement for Microsoft's Command Prompt, which goes back to the days of DOS. • Microsoft made PowerShell the default command-line interface (CLI) for Windows 10 as of build 14791. Most users first interact with PowerShell in its command-line capacity. • The key use case for PowerShell is automating various administrative activities. • Examples include navigating registries, identifying processes using the most memory and stopping/restarting a particular service. • PowerShell can also obtain model information on a computer and extract information on OSes, such as the specific version and service pack levels. • In addition, admins can use PowerShell to run commands and scripts on one or more remote computers, using protocols such as WS-Management and, more recently, Secure Shell (SSH).
  • 4. • PowerShell is used in IT departments to automate formerly manual tasks, with the objective of boosting efficiency. • Third-party IT services firms, such as managed service providers (MSPs), also use PowerShell. • MSPs tap PowerShell to automate such tasks as software deployment, software integration and report generation. • Service providers also create PowerShell scripts to periodically check on whether customers have required software installed and to automate the process of creating a new user account.
  • 5. Powershell commands - Cmdlets • Cmdlets are the foundational component of PowerShell automation. A cmdlet performs a single function and returns a .NET object. • Cmdlets are typically structured in a verb-noun format. • One or more parameters can be added to a cmdlet to make the command more specific -- directing a cmdlet to install a particular version of a software product, for example. • Ready-made cmdlets abound, and admins can learn about them through help content, which describes the cmdlet and its parameters. • Admins can create their own cmdlets using PowerShell script or C#. • All told, thousands of cmdlets exist across PowerShell and public and private repositories.
  • 6. Examples • Here are some of the basic cmdlets included in PowerShell.
  • 7. Cmdlets vs. commands • Cmdlets attempt to make it clear to the user what action they perform. That's in contrast to the sometimes truncated and cryptic command statements used in other shells. • Joey Aiello, senior program manager, PowerShell, at Microsoft, said PowerShell's "very verbose syntax" simplifies matters for people who aren't as familiar with the shorter command names used in shells such as CMD and BASH. • On the other hand, PowerShell supports aliases for admins that are accustomed to using shorter commands.
  • 8. PowerShell Cmdlets • We will discuss PowerShell cmdlets for network troubleshooting. • The first group of cmdlets deals with displaying network information so admins can confirm it is correct. • The second group covers name resolution, and • the final set looks at managing network services with PowerShell.
  • 9. • The basic PowerShell syntax is verb-noun followed by possible parameters. • For example, • Get-Date displays the system's current date and time.
  • 10. • Here are a few PowerShell tricks to remember: • PowerShell cmdlets are not case-sensitive. • Use the Format-Table cmdlet to organize output. • Use the Up arrow key to browse recent commands. • Use the Tab key after verbs to see what nouns are available -- many options are available. • Use the Tab key after a parameter dash (-) to see the available parameters. • Use the Tab key after a parameter to see the valid parameter values.
  • 11. Get-NetIPAddress • view IP address settings • Frequently, the first step in troubleshooting a network problem is confirming the host's IP address configuration. • While many admins use ipconfig to display this information, the Get-NetIPAddress cmdlet serves the same purpose.
  • 12. Get-NetIPConfiguration • display IP address details • Another option is to use the Get-NetIPConfiguration cmdlet to display details about the IP address settings. One major feature of this cmdlet is its ability to provide more focused information. Depending on the parameters admins include, the output displays information for specific interfaces and at varying levels of detail.
  • 13. Get-NetAdapter • display network interface settings • It can be helpful to display specific information about the network card itself rather than the logical addressing associated with it. Use the Get-NetAdapter cmdlet to see the interface's attributes, including name, description, interface index, status, media access control address and link speed.
  • 14. Enable-NetAdapter and Disable-NetAdapter • up and down an interface • Admins may discover another admin has downed a network interface, or perhaps someone configured the interface as a failover and kept it in the down state. They can use the Enable- NetAdapter cmdlet to reenable -- or up -- an interface. Downing the interface relies on the Disable-NetAdapter cmdlet.
  • 15. Get-NetRoute • show the routing table • If admins are confident the system's IP address settings are correct and the network interface is responsive, they may need to confirm the routing table. • Rather than using the older route command, try the Get-NetRoute cmdlet instead.
  • 16. Test-Connection and Test-NetConnection • test connectivity • Ping is probably the most ubiquitous network troubleshooting tool. • PowerShell has its own cmdlet for ping: Test-Connection. • The syntax and responses are similar to the more generic tool.
  • 17. Get-NetTCPConnection • test existing connections to server • Another connectivity check is viewing existing connections to the server. • Do this with the Get-NetTCPConnection cmdlet, which replaces the netstat command. • The output from this command may be long depending on the current connections to the system and the network services running on it. • One way to narrow the scope of the results is to request current connections by a specific port number. • For example, perhaps admins are interested in results on port 135/TCP. In that case, they can use the -LocalPort parameter, as seen below. • PS>Get-NetTCPConnection –LocalPort 135
  • 18. Resolve-DnsName • confirm name resolution works • Begin by attempting to resolve an IP address manually with the Resolve-DnsName cmdlet. This cmdlet may replace or supplement nslookup in an admin's toolbox. • PS> Resolve-DnsName google.com
  • 19. Get-DnsClient • check DNS client status • Next, check the status of the DNS client software on the local machine. The Get-DnsClient cmdlet provides this information, as seen below.
  • 20. Get-DnsClientCache and Clear-DnsClientCache • view and clear DNS cache • When troubleshooting client-side name resolution problems, it's often useful to clear the DNS cache. While the cache normally makes the name resolution process more efficient, it can potentially store incorrect or outdated information, causing name resolution to fail or return false results. Admins often use ipconfig /flushdns to do this, along with ipconfig /displaydns to view the cache.
  • 21. Get-DnsClientServerAddress • display configured DNS servers • Client computers may attempt to resolve names against invalid DNS servers. Display the configured DNS servers for a client by using the Get-DnsClientServerAddress cmdlet, as seen below.
  • 22. Get-Service • check service status • Identify services either by service name or display name. A parameter exists for both options. For example, check the status of a service by using the Get-Service -Name DhcpServer or Get- Service -DisplayName "DHCP Server" cmdlet, as shown below. • PS> Get-Service –Name DhcpServer Name DisplayName dhcp DHCP Client DNS DNS Server DnsCache DNS Client TermService Remote Desktop Services ssh-agent OpenSSH Authentication Agent
  • 23. Restart-Service • restart a service • Restarting a service uses a similar cmdlet and syntax. For example, to restart the DHCP server service, use the Restart-Service cmdlet with the -Name parameter.