I'm using the Win32::OLE module to work with the ADSI in windows 2000 server. I have a large number of computers which I must create AD accounts for, but it's not going well. With the Win32::OLE module in the latest ActiveState version of perl, I can get in and create the computer account, however there is one field I need to set -- the "netbootGUID" field -- which continues to vex me. The format we're using for the GUID in question is the computer's NIC mac address, prepended with 0s until it is the appropriate length (32 characters when setting it by hand -- 20 0s plus 12 mac address characters). The length required by the ADSI interface is a strict 16 characters. I have tried things such as
pack ("H*",$mac_and_zeros) to get a value in the proper format (I'm using the "H*" because that is the template which will successfully turn a value read from an existing object into the familiar 32 character string displayed in the object properties window), and even gone so far as to do one by hand, then simply attempt to read out the NBG and reset the exact same value, like this:
Also, to clarify, I'm using the LDAP protocol instead of the WinNT style.
Every attempt I make to set this field gives me the following error, including the read/rewrite example above (produced with Win32::OLE->LastError())
OLE error: Win32::OLE(0.1101) error 0x8007200b: "The attribute directory service is invalid" in METHOD/PROPERTYGET "SetInfo" at C:\foo\test.pl line 9.
The exception to this, is if I manually provide a value, i.e.:
$adsobj->{netbootGUID} = "0000000000000000";
and do a setinfo with that. Unfortunately, the displayed value of the NBG in the properties is most definately not all zeroes if I do this (It's actually 30303030... for 32 characters worth).
Has anyone here who has messed with ADSI/LDAP seen something like this? Is there another pack template I should use? Should I listen to the voices coming out of my mouse telling me to hunt down the person who wrote ADSI?
Thanks,
Tom Ragsdale
stingray@acl.lanl.gov
pack ("H*",$mac_and_zeros) to get a value in the proper format (I'm using the "H*" because that is the template which will successfully turn a value read from an existing object into the familiar 32 character string displayed in the object properties window), and even gone so far as to do one by hand, then simply attempt to read out the NBG and reset the exact same value, like this:
Code:
$NBG = $adsobj->{netbootGUID};
$adsobj->{netbootGUID} = "$NBG";
$adsobj->SetInfo();
Also, to clarify, I'm using the LDAP protocol instead of the WinNT style.
Every attempt I make to set this field gives me the following error, including the read/rewrite example above (produced with Win32::OLE->LastError())
OLE error: Win32::OLE(0.1101) error 0x8007200b: "The attribute directory service is invalid" in METHOD/PROPERTYGET "SetInfo" at C:\foo\test.pl line 9.
The exception to this, is if I manually provide a value, i.e.:
$adsobj->{netbootGUID} = "0000000000000000";
and do a setinfo with that. Unfortunately, the displayed value of the NBG in the properties is most definately not all zeroes if I do this (It's actually 30303030... for 32 characters worth).
Has anyone here who has messed with ADSI/LDAP seen something like this? Is there another pack template I should use? Should I listen to the voices coming out of my mouse telling me to hunt down the person who wrote ADSI?
Thanks,
Tom Ragsdale
stingray@acl.lanl.gov