OCS Script: This Perl script will enable archiving of user messages in OCS. Archiving is important to maintain legal compliance if your users are involved in any corporate litigation and so their data and communications must be saved, which may include instant messages.
The script takes a text file as input, that contains a list of user accounts for which you want to enable archiving. The text file may contain the users' common name (cn) or their NT4 logon name (samAccountName). The script then finds the user and set's their msRTCSIP-ArchivingEnabled attribute to 4 (enabled). Setting this attribute to 0 disables archiving.
use Win32::OLE;
open IN,"enable.txt";
$dse=Win32::OLE->GetObject("LDAP://RootDSE"); $root=$dse->Get("RootDomainNamingContext"); $adpath="GC://$root"; $base="<".$adpath.">"; $c = Win32::OLE->new("ADODB.Connection"); $c->{Provider} = "ADsDSOObject"; $c->Open("ADSI Provider"); $comm=Win32::OLE->new("ADODB.Command"); $comm->{ActiveConnection}=$c; $comm->{Properties}->{'Page Size'}=1000; $rs = Win32::OLE->new("ADODB.RecordSet");
while(<IN>){ chomp($user=$_); $comm->{CommandText}="$base;((cn=$user)(samaccountname=$user));distinguishedName,msRTCSIP-ArchivingEnabled;subtree"; $rs=$comm->Execute; if($rs->{recordCount} == 0){ print "X $user not found\n"; } until ($rs->EOF){ $dn=$rs->Fields(0)->{Value}; $archive=$rs->Fields(1)->{Value}; if($obj=Win32::OLE->GetObject("LDAP://$dn")){ $obj->Put("msRTCSIP-ArchivingEnabled",4); $obj->SetInfo(); print chr(251)." $user - archiving enabled\n"; }else{ print "X $user - access error ".Win32::OLE->LastError()."\n"; } $rs->MoveNext; } }
0 comments:
Post a Comment