Title: List Servers with Perl and ADSI or WMI

Is there a way to find computers in a domain using WMI or ADSI ?  This is in an NT4.0 environment and WMI is installed on all Primary Domain Controllers. Assumes Admin permissions.

The following is usually successful, but on occasion seems to miss a lot of computers.

sub GetServers   {
        my ( $domain, $pdc ) = @_;
        my ( @servers1, @servers2, @servers3 );
        unless (Win32::NetAdmin::GetServers($pdc, $domain, 0x00000008, \@servers1)) {print("Unable to read NetBios 0008.\n");}

        unless (Win32::NetAdmin::GetServers($pdc, $domain, 0x00000010, \@servers2)) {print("Unable to read NetBios 0010.\n");}

        unless (Win32::NetAdmin::GetServers($pdc, $domain, 0x00008000, \@servers3)) {print("Unable to read NetBios 8000.\n");}

        my @servers = (@servers1, @servers2, @servers3);
        return @servers;
}

Thank you.

Reply via email to