Use the blue Nav bar above to access the main index pages!

msRTCSIP-UserPolicy - Here's How to Write it

When adding or modifying Active Directory users with an Office Communication Server script, you may have to set the user's meeting policy or enterprise voice policy, or both.  In my previous post, I show how to read the contents of the msRTCSIP-UserPolicy attribute. Now let's cover how to write to it. When reading the attribute, we find that the contents are either a single or an array of DNwithBinary objects, we get the DNString and BinaryValue properties of these objects and chew on them. Luckily, writing these objects is very simple since they happily accept string input.


The string format is like so:

"B:8:policy type:DN of policy object"

The possible policy types are:

01000000: Meeting Policy
02000000: UC Policy (Voice)
04000000: Presence Policy

To figure out the DN of your policy objects, have a look at my post: List OCS Pools and Policies

So, let's say you have a meeting policy (01000000), your string should look something like this (your GUID will be different of course):

"B:8:01000000:CN={BA9AD4FA-3516-47BD-A2C2-4556AE4D7263},CN=Policies,CN=RTC Service,CN=Services,CN=Configuration,DC=myDomain,DC=com"
Once you have assembled the string for your policy you can now write to the attribute.

Write a single policy using VBScript
Set user = GetObject("LDAP://CN=myUser,CN=Users,DC=myDomain,DC=com")
meetingPolicy = "B:8:01000000:CN={BA9AD4FA-3516-47BD-A2C2-4556AE4D7263},CN=Policies,CN=RTC Service,CN=Services,CN=Configuration,DC=myDomain,DC=com"
user.Put "msRTCSIP-UserPolicy" , meetingPolicy
user.SetInfo


Write a single policy using Perl
use Win32::OLE;
$user=Win32::OLE->GetObject("LDAP://CN=myUser,CN=Users,DC=myDomain,DC=com");
$meetingPolicy="B:8:01000000:CN={BA9AD4FA-3516-47BD-A2C2-4556AE4D7263},CN=Policies,CN=RTC Service,CN=Services,CN=Configuration,DC=myDomain,DC=com";
$user->Put("msRTCSIP-UserPolicy",$meetingPolicy);
$user->SetInfo();


If you have multiple policies to write (e.g. a meeting policy and a voice policy), then you put the two strings into an array and write the array to the attribute (using the PutEX method):

Write multiple policies using VBScript
Set user = GetObject("LDAP://CN=myUser,CN=Users,DC=myDomain,DC=com")
meetingPolicy = "B:8:01000000:CN={BA9AD4FA-3516-47BD-A2C2-4556AE4D7263},CN=Policies,CN=RTC Service,CN=Services,CN=Configuration,DC=myDomain,DC=com"
voicePolicy = "B:8:02000000:CN={3AC49472-2117-4E57-AFEE-63BB8E755D46},CN=Policies,CN=RTC Service,CN=Services,CN=Configuration,DC=myDomain,DC=com"
policyList = Array(meetingPolicy,voicePolicy)
user.PutEx 2 , "msRTCSIP-UserPolicy" , policyList
user.SetInfo


Write multiple policies using Perl
use Win32::OLE;
$user = Win32::OLE->GetObject("LDAP://CN=myUser,CN=Users,DC=myDomain,DC=com");
$meetingPolicy = "B:8:01000000:CN={BA9AD4FA-3516-47BD-A2C2-4556AE4D7263},CN=Policies,CN=RTC Service,CN=Services,CN=Configuration,DC=myDomain,DC=com";
$voicePolicy = "B:8:02000000:CN={3AC49472-2117-4E57-AFEE-63BB8E755D46},CN=Policies,CN=RTC Service,CN=Services,CN=Configuration,DC=myDomain,DC=com";
@policyList = ($meetingPolicy,$voicePolicy);
$user->PutEx(2,"msRTCSIP-UserPolicy",\@policyList);
$user->SetInfo();


OK I think that horse is dead. That's how you write to the mcRTCSIP-UserPolicy attribute.

0 comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...