If you’re looking to sponsor the blog, visit the Sponsorship page.

Event Information:

  • Managing Office Communication Server (OCS) 2007 Contacts

    The Office Communicator (OC) application is not very useful without contacts. Rather than having users worry about adding the various corporate users and groups to their OC, a more effective approach is using the Microsoft Office Communications Server 2007 Resource Kit. While there are many useful tools included in the toolkit, the one focused on in this post is the LCSAddContacts.wsf script. Per Microsoft, the script is detailed to do exactly what it sounds like:

    The Microsoft Office Communications Server 2007 Add Contacts script, LCSAddContacts.wsf, is a WMI (Windows Management Instrumentation) script used to add contacts.

    Install the resource kit on your workstation. The default installation path is C:Program Files (x86)Microsoft Office Communications Server 2007ResKit (assuming a 64 bit operating system).

    At this point, you are ready to setup the script arguments and decide how best to configure for your domain.

    Using LCSAddContacts.wsf

    The usage for this script follows this format:

    Breaking this command down:

    1. cscript is a command mode that puts output from a script onto the command line. Failure to start the script with this command will result in a lot of pop-up windows with the results from the script.
    2. "C:Program Files (x86)Microsoft Office Communications Server 2007ResKitWMI Sampleslcsaddcontacts.wsf" is simply the path to the script being called by cscript.
    3. /usersFile:users.txt is a list of domain locations containing users that are being modified by the command. The users in this text file will receive the changes you are making.
    4. /contactsFile:contacts.txt contains all of the accounts you wish to add to the OC contact list of the users specified in item #3.
    5. /contactsGroup:"A Group" specifies a group to add the accounts specified in item #4 in the OC contact list. It is optional; without this argument, accounts are added to the root.

    Formatting the Text Files

    Knowing the command arguments, there are now 2 text files to create containing the locations of users to modify (#3) and the accounts to add to those user's OC contact list (#4). To properly format each text file:

    Item #3 - The users.txt file for /usersFile

    • Uses Active Directory distinguished naming format.
    • Specifies an OU (not recursive).
    • Multiple paths can be specified, separated by new lines.

    An example would be:

    Item #4 - The contacts.txt file for /contactsFile

    • Uses the SIP account name as formatted when provisioning SIP accounts in Active Directory.
    • Specifies individual accounts.
    • Multiple accounts can be specified, separated by new lines.

    An example would be:

    Organizing Contacts with Groups

    With a properly formatted users and contacts file, the LCSAddContacts.wsf script will now populate the user's OC contacts list with accounts specified in the contacts file. However, the use of contact groups will greatly add to the organization of contacts and allow the user to more efficiently sort and find contacts. Creating groups requires adding the /contactsGroup:"A Group" argument to the end of the command. No group is actually created in Active Directory; these are strictly for organizing contacts in OC. The easiest way to do this is to make a separate contacts file for each group.

    For example, in an organization with 3 departments: Sales, Marketing, and Engineering, perform the following actions:

    1. Sales: Create a sales.txt file, populate it with all SIP accounts of the sales department, and use /contactsGroup:"Sales" at the end of the script.
    2. Marketing: Create a marketing.txt file, populate it with all SIP accounts of the marketing department, and use /contactsGroup:"Marketing" at the end of the script.
    3. Engineering: Create an engineering.txt file, populate it with all SIP accounts of the engineering department, and use /contactsGroup:"Engineering" at the end of the script.

    The script would look like this:

    The result would be that all users specified in the users.txt file would receive 3 groups named Sales, Marketing, and Engineering, each populated with accounts from people in those departments.

    Note: The great part is that once the script is run, users received the updated contact lists automatically. They do not need to log off OC, restart anything, or perform any action at all. Additionally, the changes are nearly real time.

    In certain situations, it may be undesirable to apply the contact groups to all users. To add contact groups to different sets of users, create multiple users.txt files, such as for Executives / C-Level personnel, or for departments with internal sub-departments, and run the script with these users separately than the others.

    This example script would be used to add the Sales department contacts to both the Sales and Executive users, but only add the Executive department contacts to the Executive users.

    Deleting Contacts

    As users leave for various reasons, the need to purge contacts becomes apparent. To delete contacts:

    1. Create a contacts text file containing a list of users to purge. Use the same contact text file rules as for adding users.
    2. Use the /delete argument without specifying a group.

    Example script to delete the user "[email protected]" that is contained in the contact text file "terminated.txt" from the users contained in "users.txt":


    The use of line commands and text files is a bit clunky, however, the system does work. For testing, it's best to create a test account and specify only it in the users text file to ensure the script functions as required. Additionally, make sure to make the user and contact text files descriptive to avoid confusion. I personally advise against using generic terms such as "users" and "contacts" in any situation outside of this tutorial.