Network Cmdlets in Windows PowerShell 3.0
PowerShell 3.0 brings lots of handy new network cmdlets – I say cmdlets, but to be precise they are functions, but with the familiar Verb-Noun pairing.
- Research PowerShell Network Commands
- Show-Command with Get-NetIPAddress
- Example 1: Get-NetIPAddress Script
- Example 2: Get-NetIPInterface
- PowerShell 3.0 in Windows 8
♦
Research PowerShell Network Commands
Probably the easiest way to discover the version 3 cmdlets is to filter using the new PowerShell ISE panel.
Just start typing a cmdlet and as you get to the ‘-‘ so you should see the ‘Commands’ add-In.
You can see in the screenshot to the right how to select Modules, for example, NetTCPIP.
Alternatively, you could try using the trusty old Get-Command technique.
# PowerShell 3.0 Network Cmdlets
Get-Command -Noun Net*
Note 1: It may be better to filter by appending: -Noun NetIP*
Show-Command with Get-NetIPAddress
Here is an example of a useful new PowerShell 3.0 cmdlet called Show-Command. Its purpose is to research more about a cmdlet that we are interested in namely: Get-NetIPAddress.
# PowerShell’s Network Cmdlets
Show-Command Get-NetIPAddress
While I have chosen Get-NetIPAddress, you could experiment with any of these network cmdlets / functions.
Note 2: See more about Show-Command.
Example 1: Get-NetIPAddress Script
For some strange reason, the ‘Name’ property does not seem to produce any results, this is why I suggest that you use: ‘InterfaceAlias’.
Clear-Host
Get-NetIPAddress | FT InterfaceAlias, IPv4Address, RequestedState -auto.
Note 3: You can discover more properties with Get-Member
Get-NetIPAddress | GM
Note 4: There is also a sister command Set-NetIPAddress.
Guy Recommends: A Free Trial of the Network Performance Monitor (NPM) v11.5
SolarWinds’ Network Performance Monitor will help you discover what’s happening on your network. This utility will also guide you through troubleshooting; the dashboard will indicate whether the root cause is a broken link, faulty equipment or resource overload.
What I like best is the way NPM suggests solutions to network problems. Its also has the ability to monitor the health of individual VMware virtual machines. If you are interested in troubleshooting, and creating network maps, then I recommend that you try NPM now.
Download a free trial of Solarwinds’ Network Performance Monitor
Example 2: Get-NetIPInterface
Here is different PowerShell Network command, with the GetNetIPInterface cmdlet you can extract information about the MACAddress and subnet mask.
Clear-Host
Get-NetIPInterface | Format-Table InterfaceAlias, SubnetMask, MACAddress -auto
Note 5: To see all the properties, append Get-Member thus:
Get-NetIPInterface | Get-Member
Note 6: You can also call for PowerShell’s built in Get-Help thus:
Help Get-NetIPInterface
Such research reveals ideas, for example:
Get-NetIPInterface -InterfaceAlias 13
Note 6: If you need to change of these properties try the sister command Set-NetIPInterface.
The NetAdapter Family
There are a group of PowerShell cmdlets which use the NetAdapter noun. Their job is mainly to enable or disable the NIC (Network Interface Connector), see more here on Disable-NetAdapter.
Getting Started with Windows PowerShell ISE 3.0
Here are brief instructions to download and install PowerShell v 3.0.
Get Your Copy of PowerShell 3.0 CTP
As an alternative to installing Windows 8, if you have Windows 7 with SP1 or Windows Server 2008 R2 SP1, then you can download the Community Technology Preview version, see here for PowerShell 3.0 CTP.
Launching PowerShell v 3.0
Assuming you are at the Metro user interface, this is how to get started with Windows PowerShell ISE 3.0.
- From anywhere in the Metro UI, press the ‘p’ key. You should see a list of the programs and Apps.
- At this point you could right-click and ‘Pin’ the ‘Windows PowerShell ISE’.
- Incidentally, I prefer the GUI (ISE) version to the plain command line Windows PowerShell.
- I like to drag the PowerShell ISE tile to the left of my screen because it’s one of the most important Windows 8 Tiles that use.
See more of what’s new in PowerShell v 3.0 »
Summary of PowerShell Network Cmdlets
PowerShell 3.0 brings lots of handy new network functions. The easiest best way to research these new cmdlets is to filter using the new PowerShell Command / Modules panel.
If you like this page then please share it with your friends
See more Microsoft PowerShell v 3.0 examples
• PowerShell 3.0 • What’s New in PowerShell 3.0 • PowerShell v 3.0 ISE • PowerShell Home
• Get-NetAdapter • Disable-NetAdapter • Enable-NetAdapter • Get-NetIPConfiguration
• PowerShell Network Cmdlets • PowerShell 3.0 Logon Script • PowerShell Show-Command