For more information on using this script, see the article Adminstratively Managing User Contact Lists by Nick Smith.
#Contributed by Nick Smith, Microsoft
#Supported Versions: Office Communications Server 2007 R2
#Get User Information
$User = Get-WmiObject -Query "Select * from MSFT_SIPESUserSetting where PrimaryURI = 'sip: user@domain.com '"
$UserInstanceID = $User .InstanceID
#Create Contact instance
$Contact = ( New-Object System.Management.ManagementClass ( "MSFT_SIPESUserContactData" )).CreateInstance()
$Contact .UserInstanceID = $User .InstanceID
$Contact .SIPURI = "sip: userToBeAdded@domain.com "
$Contact .Subscribed = $True
#These next steps are optional unless you want to assign a contact to a contact group
$ContactGroup = ( Get-WmiObject -Query "Select * from MSFT_SIPESUserContactGroupData where UserInstanceID = '$UserInstanceID'" | Where { $_ .Name -like " NAME OF GROUP HERE " })
$Contact .GroupID = $ContactGroup .GroupID
#Create and commit contact
$Contact. Put( )