<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>The UC Corner &#187; reskit</title>
	<atom:link href="http://www.uccorner.com/tag/reskit/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.uccorner.com</link>
	<description>Unified Communications: Sharepoint, OCS, mobile communications and collaboration.</description>
	<lastBuildDate>Fri, 15 Jul 2011 09:31:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Populate contacts list in Communicator with LCSAddContacts.WSF</title>
		<link>http://www.uccorner.com/126/ocs/populate-contacts-list-in-communicator-with-lcsaddcontacts-wsf/</link>
		<comments>http://www.uccorner.com/126/ocs/populate-contacts-list-in-communicator-with-lcsaddcontacts-wsf/#comments</comments>
		<pubDate>Fri, 04 Jun 2010 12:33:27 +0000</pubDate>
		<dc:creator>Audun M. Solheim</dc:creator>
				<category><![CDATA[OCS]]></category>
		<category><![CDATA[OCS 2007 R2]]></category>
		<category><![CDATA[Office Communicator]]></category>
		<category><![CDATA[contacts]]></category>
		<category><![CDATA[groups]]></category>
		<category><![CDATA[MOC]]></category>
		<category><![CDATA[populate]]></category>
		<category><![CDATA[reskit]]></category>

		<guid isPermaLink="false">http://www.uccorner.com/?p=126</guid>
		<description><![CDATA[<p>Often, it can be a good idea to pre-populate Communicator (MOC) in an Office Communications Server 2007 R2 before end users start to use MOC. That way they&#8217;ll not be met with an &#8220;empty&#8221; contact list when they log on to MOC. For example, you might want to populate a user&#8217;s contact list with a [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.uccorner.com/wp-content/uploads/2010/06/contacts.png"></a>Often, it can be a good idea to pre-populate Communicator (MOC) in an Office Communications Server 2007 R2 before end users start to use MOC. That way they&#8217;ll not be met with an &#8220;empty&#8221; contact list when they log on to MOC. For example, you might want to populate a user&#8217;s contact list with a group containing the members of the department the user belongs to. It&#8217;s rather easy to use LCSAddContacts.WSF to accomplish this, but I wanted to automate the process based on AD security groups, not only which OU the users/contacts belong to. I am doing all these commands from C:\Program Files\Microsoft Office Communications Server 2007 R2\ResKit\WMI Samples for simplicity.</p>
<ol>
<li>First, I need to list all the users in the AD Group containing the contacts, using the DN (Distinguished Name) of the group:<br />
<strong>dsget group &#8220;CN=SomeGroup,OU=SomeOuAlso,OU=SomeOU,DC=domain,DC=com&#8221; -members -expand &gt; members.txt<br />
</strong></li>
<li>Then, I need to get the msRTCSIP-PrimaryUserAddress for these contacts:<br />
<strong>for /F &#8220;delims=&#8221; %x in (&#8216;type members.txt&#8217;) do (dsquery * %x –l -attr msRTCSIP -PrimaryUserAddress &gt;&gt; contacts.txt)<br />
</strong>Now I have a list over the contacts that should be populated into the contact list in MOC. The delims= is necessary to read the full lines also if there are spaces. The -l attribute is needed to get only the attribute, not also the name of the attribute for each line. If contacts.txt exists, make sure it&#8217;s empty at the script does not overwrite the file, but only appends new lines.</li>
<li>Now I need to get the users that should get these contacts:<br />
<strong>dsget group &#8220;CN=SomeOtherGroup,OU=SomeOtherOU,OU=SomeOU,DC=domain,DC=com&#8221; -members -expand &gt; userlist.txt<br />
</strong></li>
<li>Then, I need to get the msRTCSIP-PrimaryUserAddress for these users:<br />
<strong>for /F &#8220;delims=&#8221; %x in (&#8216;type userlist.txt&#8217;) do (dsquery * %x -l -attr msRTCSIP-PrimaryUserAddress &gt;&gt; users.txt)<br />
</strong></li>
<li>Let the magic happen:<br />
<strong>cscript LCSAddContacts.WSF /usersfile:users.txt /contactsfile:contacts.txt /contactsgroup:&#8221;My group&#8221;</strong></li>
</ol>
<p>This would be a lot easier if the users and/or the contacts could be picked from a OU (or even manually enter the sip adresseses to users.txt or contacts.txt), but in a real-world scenario you might want to create MOC Contact groups based on AD groups.</p>
<p>Result:</p>
<p><a href="http://www.uccorner.com/wp-content/uploads/2010/06/contacts.png"><img title="contacts in MOC Communicator" src="http://www.uccorner.com/wp-content/uploads/2010/06/contacts.png" alt="" width="364" height="423" /></a></p>
<p>P.S. Existing groups with the same same will not be overwritten, nor will existing contacts in that group. Only new contacts will be added.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.uccorner.com/126/ocs/populate-contacts-list-in-communicator-with-lcsaddcontacts-wsf/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

