To quickly gather the information I needed for a script, I simply wanted to identify one (or more) IP addresses that were enabled on my machine. Using the Scripting Guys post,
Use PowerShell to Identify Your Real Network Adapter
I was able to quickly take the following command, and, get basic information for my NIC.
The beauty here is that you can zero in on a specific property (the results of wrapping in parentheses and using .IPAddress) then pipelining to a Where-Object cmdlet to test if the value can be typed as a [System.Version] object. Since IPv4 addresses pass as [System.Version] objects, this is a foolproof way to find an IP address without having to parse a lot of data or use complex expressions.
0 comments:
Post a Comment