Obtaining an Office Communications Server User Instance ID

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

The following code sample demonstrates how to obtain an Office Communications Server user's instance ID based on a supplied URI for the user.

To execute this code successfully, you must be a member of the Office Communications Server Domain User Admin group.

Public Function ObtainLCUserInstanceID(URI)

' Connect to the WMI server.
Set wmiServer = CreateObject("WbemScripting.SWbemLocator").ConnectServer()

'Do error checking here.

Query = "SELECT InstanceID FROM MSFT_SIPESUserSetting where PrimaryURI = '" & URI & "'"

Set LCUserEnum = wmiServer.ExecQuery(Query)

'Do error checking here.

WScript.Echo "The following Office Communications User Instance IDs matched the supplied URI:"

For each LCUser in LCUserEnum

WScript.Echo LCUser.InstanceID

ObtainLCUserInstanceID = true

End Function