PowerShell for Windows Admins:

Network


July 18, 2011  12:36 PM

Joining objects



Posted by: Richard Siddaway
Network, PowerShell v2, WMI

PowerShell doesn’t have the equivalent of an SQL Union statement that lets you join objects together. What you can do is use New-Object to create the joined output.

As an example that recently came up on a forum

$outputs 
				
				
  Bookmark and Share     0 Comments     RSS Feed     Email a friend

July 9, 2011  6:45 AM

Linking the network card to the Registry settings



Posted by: Richard Siddaway
Network

An interesting problem from the forum. Get the IP enabled network adapters and read the associated registry keys to get the value of the NetLuidIndex.

$HKLM = 2147483650         ...


June 29, 2011  12:42 PM

Network Connection Ids



Posted by: Richard Siddaway
Network, PowerShell v2, Windows 2008 R2, Windows 7, WMI

Yesterday I was looking at changing a Network connection id (the name that shows in Network and Sharing Center when you look at the adapters). I kept getting an error – either COM or number of arguments depending if I was running locally or remotely.

I eventually realised that I must...


May 21, 2011  3:01 AM

Testing network connectivity



Posted by: Richard Siddaway
Network

One of the standard troubleshooting tasks when investigating a problem is deciding if the machine can communicate on the network. The approach is usually

  • ping the loop back address to check TCP/IP is working
  • ping the machines own address
  • ping the default...


May 1, 2011  4:13 AM

PowerShell Deep Dive: V WMI associations



Posted by: Richard Siddaway
Network, PowerShell v2, WMI

NOTE: If you are wondering why the Deep Dive posts are non-consecutive – they are part of a longer series posted here

Bookmark and Share     0 Comments     RSS Feed     Email a friend


March 13, 2011  1:38 PM

WMI–Provider Load Failure



Posted by: Richard Siddaway
Network, PowerShell v2, Windows 2008 R2, WMI

I’m currently writing Chapter 11 of PowerShell and WMI and its about using the WMI classes related to networking. I tried the Win32_NetworkAdapter on the HP laptop I use for writing and everything worked fine. Tried it on my Lenovo that I use as a Hyper-V server and got a Provider Load failure...


October 8, 2010  12:31 PM

WMI and Network Adapters: 10



Posted by: Richard Siddaway
Network

In episode 10 we saw how to renew the lease of a DHCP enabled NIC.  What about dropping the lease all together?

Lets go back to the NIC we are experimenting on.

Get-WmiObject -Class Win32_NetworkAdapterConfiguration -Filter "Index='11'"  | gm -MemberType...


October 6, 2010  2:53 PM

WMI and Network Adapters: 9



Posted by: Richard Siddaway
Network, PowerShell v2

We have seen how to test if a NIC is DHCP enabled but what about manipulating the DHCP settings.  First off lets look at renewing a DHCP lease.

We can see the lease information

Get-WmiObject -Class Win32_NetworkAdapterConfiguration -Filter "Index='11'"  |...


September 30, 2010  12:28 PM

WMI and Network Adapters: 8



Posted by: Richard Siddaway
Network

We were looking at MAC Addresses last time. We can filter on MAC address

Get-WmiObject -Class Win32_NetworkAdapter -Filter "MACAddress='00:27:2B:F5:96:D5'"

No its not my real MAC address :-)

There are two useful methods on the NetworAdapter class – Disable and...


September 29, 2010  1:20 PM

WMI and Network Adapters: 7



Posted by: Richard Siddaway
Network

One task I find myself doing on a regular basis is checking the physical address of a NIC. Ipconfig is OK but we have to wade through a lot of stuff.  Much simpler to do this

Get-WmiObject -Class Win32_NetworkAdapter -ComputerName "." |
select Name, MACAddress

...