Try using:

Win32::AdminMisc::GetMachines($PDC, UF_WORKSTATION_TRUST_ACCOUNT, \@List, "")

This returns a list of all workstation accounts on the PDC.  You will need to
delete the trailing $ from each element in the list.

Eric Buller








[EMAIL PROTECTED] on 11/22/2000 02:16:10 PM
                                                                                
                                                                                
                                                                                


                                                              
                                                              
                                                              
 To:      [EMAIL PROTECTED]          
                                                              
 cc:      (bcc: Eric Buller/Lrcc)                             
                                                              
                                                              
                                                              
 Subject: RE: Workstations Only                               
                                                              







Is there a way to get a list of all NT workstations including those inactive
in the domain? I want to get a list that is matching what is showing in the
Server Manager. The perl script that I use similar to the one that posted
can only give me those currently active.

--Gary Wong

-----Original Message-----
From: Bellenger, Bruno (Paris) [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 14, 2000 4:33 AM
To: '[EMAIL PROTECTED]'
Cc: 'Raghuram P'
Subject: RE: Workstations Only


To list all workstations in the given domains using NetAdmin :
(see the attached .TXT file in the mailer messes up the code)


#///////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////

#List all workstations in the given domains using NetAdmin

use Win32::NetAdmin;

foreach $domain (@ARGV) {
     print "\nDOMAIN:\t$domain\n";
     unless (Win32::NetAdmin::GetDomainController("", $domain, $pdc)) {
          print "Unable to obtain the PDC name for $domain."; next;
          }
     unless (Win32::NetAdmin::GetServers($pdc, $domain, 0x00000001,
\@workstations))  {
          print "Unable to get the PDC name.\n";
               }
          foreach $workstation (@workstations) {
          print " WS:\t$workstation\n";
               }
               }

     @servers = (@workstations, @servers2, @servers3);
     print " TOTAL:\t", $#workstations + 1,"\n" if (@workstations);
     $grandtotal += $#workstations + 1 if (($#domains) && (@workstations));


print "\nGRAND TOTAL: $grandtotal\n" if $grandtotal;

#///////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////





Or you can use the Lanman module too.
(see the attached .TXT file too in the mailer messes up the code)




#///////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////

# NetServerEnum($server, $domain, $type, \@info)
# Lists all servers of the type SV_TYPE_NT that are visible
# in the domain testdomain. The command will be executed on \\\\$server.
# For more on server types see
# http://www.outbreaksw.com/Code/Network/NetServerEnum.html
# SV_TYPE_WORKSTATION All workstations
# SV_TYPE_SERVER All servers
# SV_TYPE_SQLSERVER           Any server running with Microsoft SQL Server

# SV_TYPE_DOMAIN_CTRL         Primary domain controller
# SV_TYPE_DOMAIN_BAKCTRL      Backup domain controller
# SV_TYPE_TIME_SOURCE         Server running the Timesource service
# SV_TYPE_AFP            Apple File Protocol servers
# SV_TYPE_NOVELL         Novell servers
# SV_TYPE_DOMAIN_MEMBER  LAN Manager 2.x domain member
# SV_TYPE_LOCAL_LIST_ONLY     Servers maintained by the browser. See the
following Remarks section.
# SV_TYPE_PRINT          Server sharing print queue
# SV_TYPE_DIALIN         Server running dial-in service
# SV_TYPE_XENIX_SERVER        Xenix server
# SV_TYPE_MFPN                Microsoft File and Print for Netware
# SV_TYPE_NT             Windows NT/Windows 2000 workstation or
server
# SV_TYPE_WFW            Server running Windows for Workgroups
# SV_TYPE_SERVER_NT           Windows NT/Windows 2000 server that is not a
domain controller
# SV_TYPE_POTENTIAL_BROWSER   Server that can run the browser service
# SV_TYPE_BACKUP_BROWSER      Server running a browser service as backup
# SV_TYPE_MASTER_BROWSER      Server running the master browser service
# SV_TYPE_DOMAIN_MASTER  Server running the domain master browser
# SV_TYPE_DOMAIN_ENUM         Primary domain
# SV_TYPE_WINDOWS        Windows 95 or later
# SV_TYPE_ALL            All servers
# SV_TYPE_TERMINALSERVER      Terminal Server
# SV_TYPE_CLUSTER_NT          Server clusters available in the domain



#=================================================
# SPECIFY THE TARGET DOMAIN AS FIRST ARGUMENT.
#=================================================
use Win32::Lanman;

$domain = "$ARGV[0]" ;


# Get PDCs
print "\n\n\n PRIMARY DOMAIN CONTROLLERS : \n" ;
print "------------------------------------------\n" ;

Win32::Lanman::NetServerEnum('', "$domain", SV_TYPE_DOMAIN_CTRL, \my @PDC)
or die $^E;
foreach (@PDC) {
print " $_->{name} -> $_->{comment}\n";
}


# Get BDCs
print "\n\n\n DOMAIN BACKUP CONTROLLERS : \n" ;
print "------------------------------------------\n" ;
Win32::Lanman::NetServerEnum('', "$domain", SV_TYPE_DOMAIN_BAKCTRL, \my
@BDC) or die $^E;
foreach (@BDC) {
print " $_->{name} -> $_->{comment}\n";
}



# Get Member Servers
print "\n\n\n DOMAIN MEMBER SERVERS : \n" ;
print "------------------------------------------\n" ;
Win32::Lanman::NetServerEnum('', "$domain", SV_TYPE_SERVER_NT, \my @Servers)
or die $^E;
foreach (@Servers) {
print " $_->{name} -> $_->{comment}\n";
}


# Take a look at the $ref->{type} field returned, to see what values are
attributed to Terminal Servers, SMS, etc.

#print "------------------------------------------\n" x 3 ;

# Get list of servers running SQL server :
print "\n\n\n SERVERS RUNNING SQL SERVERS : \n" ;
print "------------------------------------------\n" ;
Win32::Lanman::NetServerEnum('', "$domain", SV_TYPE_SQLSERVER, \my
@SQLservers) or die $^E;
foreach (@SQLservers) {
print " $_->{name} -> $_->{comment}\n";
}

print "------------------------------------------\n" x 5 ;

#///////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////


 <<Win32_Lanman_NetServerEnum2.txt>>
<<LIST_WORKSTATIONS_IN_DOMAIN.txt>>
_____________________________________________
Bruno Bellenger
Sr. Network/Systems Administrator


     -----Original Message-----
     From:     Raghuram P [SMTP:[EMAIL PROTECTED]]
     Sent:     Tuesday, November 14, 2000 11:21
     To:  '[EMAIL PROTECTED]'
     Subject:  Workstations Only

     Hello All

     I am trying to list all the Windows NT Workstations only for a given
domain
     by using the following line
     Win32::NetAdmin::GetServers(' ',$domain,$machtype,\@List1)
     where
     $domain = "Somedomain"
     $machtype = SV_TYPE_WORKSTATION,
     but the output list also contains all the Win NT Server Names in the
domain.

     1) Am I doing something wrong , is there another way for listing
only
     windows nt workstations.?
     2) Is it possible to find the Number of Hard Disks/CD Rom /DVD Rom
and there
     identifiers( for ex ST39236 Seagate 9 GB)  on a remote pc ?

     Thanks In Advance
     Raghu

     _______________________________________________
     Perl-Win32-Admin mailing list
     [EMAIL PROTECTED]
     http://listserv.ActiveState.com/mailman/listinfo/perl-win32-admin
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-admin

att1.eml

Reply via email to