[This is pre-release documentation and subject to change in future releases. This topic's current status is: Milestone-Ready]

Topic Last Modified: 2010-07-18

Microsoft Communications Server 2010 features a huge number of cmdlets that enable you to retrieve, edit, create, and remove policies; what the software doesn’t include, however, are any cmdlets that enable you to copy the property values from one policy to the next. For example, there’s no straightforward way to copy a voice policy configured for the Redmond site to the Dublin site.

One way to uncover available line URIs is to use a Windows PowerShell script. To use the script, copy the code, paste it into a text editor such as Windows Notepad, and then save the file using a .ps1 file extension (for example, C:\Scripts\CombinedOutput.Ps1). From within the Communications Server Management Shell you can then run the script by typing in the full path to the script file followed by the starting line URI value and the ending line URI value:

Copy Code
C:\Scripts\AvailableLineURIs.ps1 7700 7799

Note that this prototype script is designed to work only with the last four digits of the line URI. For example, the script can look for unassigned line URIs that fall between the values TEL:+14255551200 (1200) and TEL:+14255551500 (1500). However, the script cannot find unassigned line URIs in a larger range such as TEL:+12065551200 (2065551200) and TEL:+14255551500 (4255551500). If you want to search for unassigned numbers in a larger range then you will need to modify the script:

Copy Code
$z = @()

$x = Get-CsUser -Filter {LineUri -ne $Null} | Select-Object LineUri

foreach($i in $x) 
	{
		$y = $i.LineUri
		$z += $y.Substring($y.Length -4, 4)
}  

for ($i = $args[0]; $i -le $args[1]; $i++)
	{
		$b = $z -contains $i
		if($b){}
		else {$i}
}

Note, too that this sample script only returns line URIs that have been assigned to users. If you have line URIs that have been assigned to contacts or devices (such as a common area phone) those URIs will not be reported by this sample code.