[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 includes two different cmdlets that retrieve user account information: Get-CsAdUser, which returns information about all your Active Directory user accounts; and Get-CsUser, which returns information only about those Active Directory user accounts that have been enabled for Communications Server.

In addition to returning different sets of users, the two cmdlets also return different sets of attribute values. For the most part, Get-CsAdUser returns generic Active Directory attributes such as the user’s department and job title; by contrast, Get-CsUser primarily returns attribute values related to Microsoft Communications Server (for example, attributes that tell you whether the user has been enabled for Enterprise Voice or for remote call control).

That becomes a bit of a problem when you want to return information that includes both generic Active Directory attributes and Communications Server-specific attribute. (For example, you might want to view a user’s department and the voice policy that has been assigned to that account.) Although there is no single cmdlet that will return that information, you can use a Windows PowerShell script that is able to combine the output of the two cmdlets. 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 Identity of the user you want to return this information for:

Copy Code
C:\Scripts\CombinedOutput.ps1 "Ken Myer"

This sample script returns the values for the DisplayName and VoicePolicy attributes (information retrieved by using Get-CsUser) and for the Department attribute (retrieved by using Get-CsAdUser):

Copy Code
$x = Get-CsUser $args[0] | Select-Object DisplayName, VoicePolicy

$a = $x.DisplayName
	if ($a -ne "")
	{
		$b = Get-CsAdUser -Identity $a
		$x | Add-Member -MemberType NoteProperty -Name `
		Department -Value $b.Department
		$x
}