I think what this is really telling you is that there are no mandatory
properties for a user.  

Download a copy of the ADSI SDK.

There is a utility (ADSVW.EXE) in the SDK, where you can look at LDAP and
WinNT objects for things like the optional and mandatory status of given
properties as well as their values, classes, and so on.  It's a good second
opinion when your code isn't doing what you think it should.  Or better yet,
you can poke around and look at the directory structure of given objects.

Best of all it's free.

Steven

-----Original Message-----
From: Thoenen, Peter Mr. EPS
[mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, September 10, 2002 9:30 PM
To: [EMAIL PROTECTED]
Subject: Stuck on a simple Win32:OLE and ADS issue.


Trying setup my first perl script to automate some ADS tasks and hitting a
wall at on step 1 :)  What I am trying to do is list ALL properties of an
ADS object.

Tried to use the following snippet of code right out of Perl for System
Administrators:



#########################

use warnings;
use strict;

use Win32::OLE;

$ADsPath='WinNT://SOME_DOMAIN/SOME_USER';
$adsobj = Win32::OLE->GetObject($ADsPath);
$schmobj = Win32::OLE->GetObject($adsobj->{Schema});
print join("\n",@{$schmobj->{MandatoryProperties}},
                @{$schmobj->{OptionalProperties}}),"\n";

########################3



Now the OptionalProperties part works (is printed directly after the below
error) ... but MandatoryProperties errors with:

Win32::OLE(0.1502) error 0x8002000b: "Invalid index" at E:\working\ads.pl
line 9
Use of uninitialized value in array dereference at E:\working\ads.pl line 9.

Have also tried using (from
http://public.activestate.com/authors/tobyeverett/tutorial.html)



########################

use warnings;
use strict;

use Win32::OLE;

$ADsPath='WinNT://SOME_DOMAIN/SOME_USER';
$obj = Win32::OLE->GetObject($ADsPath);
my $schema = Win32::OLE->GetObject($obj->{schema});
foreach my $i (@{$schema->{MandatoryProperties}},
@{$schema->{OptionalProperties}}) {
  print "$i:\t".$obj->Get($i)."\n";
}

#############



but getting the exact same error.  Any ideas what copying did wrong? 

Cheers and thanks in advance,

-Peter

##################################
Peter Thoenen - Systems Programmer
Commercial Communications
Camp Bondsteel, Kosovo
##################################

"Stumbled Upon"...heh (Score:5, Funny) /.
by $carab on 23:00 23 August 2002 (#4131637)

"ForensicTec officials said they stumbled upon the military networks about
two months ago, while checking on network security for a private-sector
client."

Someone new to a Dvorak probably tried to type in "lynx
http://www.google.com"; but instead got "nmap -v -p 1-1024 -sS -P0 army.mil
-T paranoid".
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to