I'm working on a script to create phone number blocks out of number ranges in Lync, and I have a requirement to use full e.164 numbers which can be up to 15 digits which are proving to be a bit of a problem. When I pull out the start and end numbers for a given range, I get something like:
NumberRangeStart : tel:+19995551200
NumberRangeEnd : tel:+19995551299
I go to strip off the leading text and Powershell turns the number into an Int64 as expected:
$RangeStartInt = $Range.NumberRangeStart.TrimStart("tel:+")
$RangeEndInt = $Range.NumberRangeEnd.TrimStart("tel:+")
So my variables are now 19995551200 and 19995551299. When I go to create the array using the range operator, I get:
PS C:\WINDOWS\system32> $RangeStartInt..$RangeEndIntCannot convert value "19995551200" to type "System.Int32". Error: "Value was either too large or too small for an Int32."
At line:1 char:1
+ $RangeStartInt..$RangeEndInt
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvalidCastIConvertible
My question is this, does the range operator only work on Int32 objects? Is there an alternative that might work on Int64 objects or should I just use something like an i++ to create the array manually? Any thoughts are appreciated as it's very strange...