Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

IP array to IP range

$
0
0

Hi guys

Learning Poweshell and stuck at which seems to be an easy task, but wrecking my brain on it for some time...

I have a list of IP addresses in an array $ipArray. I need to go through this list and return IP addresses grouped in IP range (if they can be grouped) or just plain IP.

Something like this:

10.18.130.136
10.18.130.137
10.2.110.167

10.18.130.138
10.2.110.170
10.18.130.139

OUTPUT:

10.18.130.136 - 10.18.130.139
10.2.110.167
10.2.110.170


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>