If you want to get the machines on the domain, you'll want to use another
function.  The NetAdmin GetServers function checks for machines that are on
the NETWORK that are running various services, in this case the Server
service.  Try using GetUsers and filtering for users with a $ at the end of
the name, as has been suggested, or I would suggest using Win32::AdminMisc's
GetMachines function.

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

use Win32::AdminMisc;
my @systems;
Win32::AdminMisc::GetMachines($pdc,UF_WORKSTATION_TRUST_ACCOUNT|UF_SERVER_TR
UST_ACCOUNT,\@systems);
foreach(@systems){
   print "$_\n";
}

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

-----Original Message-----
From: Chuck Lawhorn [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 01, 2002 12:10 PM
To: [EMAIL PROTECTED]
Subject: Re: enumerating machines...


If you list all the accounts in your domain, the workstation accounts will
all end with a dollar
sign. I have used that method to get a list of worklststions on a domain. 

--Chuck

--- Mathew Shember <[EMAIL PROTECTED]> wrote:
> Type_ALL is as the name implies.  Everything.  So If you have win9x, 
> me,  They will get counted as well.
> 
> You could change it to SV_TYPE_NT.    This does list 2000 and XP machines.
> 
> Other things to watch.
> 
> Samba servers will appear.
> Network Appliance boxes will appear.
> 
> 
> Finally, keep in mind.  You are scanning the domain list which holds any 
> machine account that is created.   If you never remove dead accounts, they

> are listed as well.
> 
> At 11:05 AM 4/1/2002 -0500, Rick Coloccia wrote:
> >Everyone,
> >
> >Maybe someone has some experience doing what I'm trying to do:
> >
> >I am in a mixed windows 2000 domain (not native mode, there are still nt4

> >boxes, etc, around.)
> >
> >When I go into the Active Directory Users and Computers application and 
> >view all the computers I have, I see that there are 727 objects (NT4,
W2k, 
> >WinXP machines).
> >
> >
> >I want to use perl to create that list somehow. When I run the code I
have 
> >below, I get 280 computers.  I suspect that the filter I'm using 
> >(SV_TYPE_ALL) is at fault, but I can't seem to find anything more 
> >appropriate.  Does anyone have any suggestions?
> >
> >Thanks!
> >
> >-Rick
> >
> >
> >
> >use Win32::NetAdmin;
> >
> >$count=0;
> >
> >Win32::NetAdmin::GetServers(undef, "GENESEO", SV_TYPE_ALL,
\%all_server_ref);
> >
> >foreach $server (keys(%all_server_ref)) {print "$server\n"; $count++; }
> >
> >print $count;
> >
> >


__________________________________________________
Do You Yahoo!?
Yahoo! Greetings - send holiday greetings for Easter, Passover
http://greetings.yahoo.com/
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


--------------------------------------------------------------------------------
This email may contain confidential and privileged 
material for the sole use of the intended recipient. 
If you are not the intended recipient, please contact 
the sender and delete all copies.
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to