Brilliant! Obvious in hindsight. Thanks a lot. 

--
    Regards, Willem


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Ken Cornetet
Sent: Tuesday, August 24, 2004 9:20 PM
To: [EMAIL PROTECTED]
Subject: RE: [ActiveDir] read mS-DS-ReplicatesNCReason with Perl?

use strict;
use Win32::OLE;
use Data::Dumper;

my $strDcRDN   = "cn=nts0";
my $strSiteRDN = "cn=Jasper-North";
my $objRootDSE = Win32::OLE->GetObject("LDAP://RootDSE";);

my $strConfigurationNC = $objRootDSE->Get("configurationNamingContext");
my $strNtdsSettingsPath = "LDAP://cn=NTDS Settings, $strDcRDN,
cn=Servers, $strSiteRDN, cn=Sites, $strConfigurationNC";
my $objNtdsSettings = Win32::OLE->GetObject($strNtdsSettingsPath);

foreach my $objConnection (in $objNtdsSettings) {
    print "Name: $objConnection->{Name}\n";
    my $obj = $objConnection->GetEx("ms-DS-ReplicatesNCReason");
    foreach my $objDNWithBin (@{$obj}) {
        print $objDNWithBin->{DNString} , "\n";
    }
}


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Willem Kasdorp
Sent: Tuesday, August 24, 2004 1:14 PM
To: [EMAIL PROTECTED]
Subject: [ActiveDir] read mS-DS-ReplicatesNCReason with Perl?


Hi, 
 
I know that there are some Perl guru's on this list, one of who's name
starts with a 'j' and ends in 'oe'... so I thought I'd ask a tricky
question. 
 
I'm writing a Perl script to monitor my replication topology. One of the
things I need to accomplish is to read the attribute
mS-DS-ReplicatesNCReason from a connection object. This turns out to be
surprisingly hard... in Perl, that is. Browsing technet gives the
following trivial piece of VBS script that works just fine:
 
For Each objDNWithBin In objConnection.GetEx("ms-DS-ReplicatesNCReason")
Wscript.Echo objDNWithBin.DNString
Next
 
However, a similar syntax in Perl fails miserably:
$o_co->GetEx("mS-DS-ReplicatesNCReason")
 
It returns an object of type "DN Binary", and I cannot find a way to
tell Perl how to deal with it. Robbie Allen in his excellent cookbook
has a recipe involving the IadsTools dll. Is there no way around it? Is
Perl really inferior to VBS in this respect? Surely not ...
 
Thanks,
 
 
 
List info   : http://www.activedir.org/mail_list.htm
List FAQ    : http://www.activedir.org/list_faq.htm
List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/


List info   : http://www.activedir.org/mail_list.htm
List FAQ    : http://www.activedir.org/list_faq.htm
List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/

Reply via email to