Check if a Contact Distribution Group Exists
Published May 20 2019 02:40 PM 119 Views
Occasional Visitor
First published on TECHNET on Nov 12, 2010


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

#Check if group is already added to user's contact list

$ContactGroup = ( Get-WmiObject -Query "Select * from MSFT_SIPESUserContactGroupData where UserInstanceID = '$UserInstanceID'" | Where { $_ .ExternalURL -like "* group@domain.com *" })

if ( $ContactGroup -ne $null ) { #The group is on the user's contact list

Write-Host "The group exists on the user's contact list"

}

elseif ( $ContactGroup -eq $null ) { #The group is not on the user's contact list

Write-Host "The group does not exist on the user's contact list"

}


Version history
Last update:
‎May 20 2019 02:40 PM
Updated by: