[prev in list] [next in list] [prev in thread] [next in thread] 

List:       perl-win32-admin
Subject:    Re: NT domain List (and computer, group, user)
From:       "Leo D." <motomo94 () yahoo ! com>
Date:       1999-10-21 15:56:04
[Download RAW message or body]

Ok I tried running this script.  But I get the following errors.
EnumDomain():
Win32::OLE(0.1008) error 0x800401e4: "Invalid syntax"
    after character 0 in "WinNT:" at d:\perl\domain.pl line 12.
I'm running this on a Win NT workstation 4.0 with SP5  I have IE5 
installed. I confirmed all modules are current. I have Active State 521e.  
I reinstalled IE5.
Now when I removed the statement "die Win32::OLE->LastError() unless (" The 
script would return my PDC but I would get another OLE error.
Does any one know what could be the problem?
Or
Does anyone know another way to get this info for the Domain.
Thanks

Leo

On 10/19/99, "Garrett Goebel <garrett@scriptpro.com>" wrote:
> I'm working on creating a perl script to audit our company network.  The
> following script will produce lots of useful information...
> 
> use strict;
> use Win32::NetAdmin;
> use Win32::OLE;
> use Win32::OLE qw( in );
> 
> &EnumDomain();
> 
> sub EnumDomain {
>     my ($obj, $domain, $d, $g, $m, $l, $pdc);
>     print "\nEnumDomain():\n";
> 
>     die Win32::OLE->LastError() unless ($obj =
> Win32::OLE->GetObject("WinNT:"));
>     $obj->{Filter} = ["domain"];
>     foreach $d (in $obj) {
> 	print "\n\n\nDomain: $d->{'NAME'}\n";
> 
> 	$pdc='';
>         Win32::NetAdmin::GetDomainController('',$d->{'NAME'},$pdc);
> 	$pdc =~ s/\\\\//;
> 	if (!$pdc) { 
>             print "\n". " "x3 ."PDC=[WorkGroup (no PDC)]\n"; 
>         } else { 
>             print "\n". " "x3 ."PDC=$pdc\n"; 
> 	}
> 
> 	$domain = Win32::OLE->GetObject("WinNT://$d->{'NAME'}") 
> 	    || croak Win32::OLE->LastError();
> 	$domain->{Filter} = ["computer"];
> 	print "\n". " "x3 ."Computers:";
> 	foreach $m (in $domain) { 
> 	    print " $m->{'NAME'}";
> 	} 
> 	print "\n";
> 
> 	#IsDomain?
> 	if ($pdc) { 
> 	    $domain->{Filter} = ["group"];
> 	    print "\n". " "x3 ."Groups: ";
> 	    foreach $g (in $domain) { 
> 		print " $g->{'NAME'}" ;
> 	    } 
> 	    print "\n";
> 
> 	    $domain->{Filter} = ["user"];
> 	    print "\n". " "x3 ."Users:";
> 	    foreach $l (in $domain) { 
> 		print " $l->{'NAME'}"; 
> 	    } 
> 	    print "\n";
> 	}
>     }
> }
> 
> --
> Garrett Goebel
> Software Developer
> 
> ScriptPro LLC           Phone: 913-384-1008 x261
> 5828 Reeds Road           Fax: 931-384-2180
> Mission, KS 66202       email: garrett@scriptpro.com

---
You are currently subscribed to perl-win32-admin as: [perl-win32-admin@progressive-comp.com]
To unsubscribe, forward this message to
         leave-perl-win32-admin-90393O@lyris.activestate.com
For non-automated Mailing List support, send email to  
         ListHelp@ActiveState.com

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic