# Search-UcmCsOnPremNumberRange

## Overview

Helps plan migration of on prem number ranges into MSTeams by reporting how many of each item type is in a number range.\
Returns a variable containing the following items in either Summary or Detailed form

* PrivateLines
* Analog Devices
* Common Area Phones
* Exchange UM Answer Points
* Dial In Conference&#x20;
* Response Groups

## Description

Checks to see how many numbers are assigned in a number range to each service, returns a summary of the results or a full listing depending on the presence of the -summary parameter Presently only supports number blocks aligned to full number ranges (00-99 for example.)

Note, the function currently performs a search based on a [PowerShell -match](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_comparison_operators?view=powershell-7.2#matching-operators) filter, thus presently only whole ranges are supported. \
IE: -Start +613864086400 -End +613864086499, -Start +613864086000 -End +61386408699 or -Start +613864080000 -End +61386409999

{% hint style="warning" %}
Attempting to search for subranges will return all items in the whole range. For example, searching for +61386408640 to +61386408650 will actually return everything between +61386408600 and +61386408699 as the last 2 digits cant be aligned.
{% endhint %}

## Parameters

#### Start (Required)&#x20;

The first number in the number range to be searched, can be in the following formats tel:+61386408600 +61386408600 386408600

#### End (Required)

The last number in the number range to be searched, can be in the following formats tel:+61386408699 +61386408699 386408699

#### Summary

Only returns the count of each object found in the number range, otherwise a PSCustom Object containing a list of the objects is returned for each object type (see Output)

## Example

```powershell
Search-UcmCsOnPremNumberRange -Start "61386408600" -End "61386408699" -Summary
```

## Inputs

This cmdlet does not accept pipeline input

## Outputs

This Cmdet returns a PSCustomObject with multiple keys to indicate the results <br>

**Return.Status** can return one of four values \
\&#xNAN;**"OK" :** Connected to Skype for Business Online \
\&#xNAN;**"Warning" :** Reconnected to Skype for Business Online \
\&#xNAN;**"Error" :** Not connected to Skype for Business Online \
\&#xNAN;**"Unknown" :** Cmdlet reached the end of the function without returning anything, this shouldn't happen, if it does please log an issue on Github

**$Return.Message** returns descriptive text showing the connected tenant, mainly for logging or reporting

**$Return.Users** \
**$Return.PrivateLines** \
**$Return.AnalogDevices** \
**$Return.CommonAreaPhones** \
**$Return.ExchangeUM** \
**$Return.DialInConf** \
**$Return.ResponseGroups**

Each of the above returns either an object count (when using -summary) or a list of the associated objects

**$Return.All** returns either a total count of objects, or a full list of the located objects.
