#!perl # # As long as you have the module, you should not have to change a thin +g! # use Win32::NetAdmin; my $PDC; my $domain = Win32::DomainName or die "Unable to obtain the domain nam +e\n"; Win32::NetAdmin::GetDomainController("","",$PDC); Win32::NetAdmin::GetServers($PDC, $domain, SV_TYPE_DOMAIN_CTRL, \@pdc) +; Win32::NetAdmin::GetServers($PDC, $domain, SV_TYPE_DOMAIN_BAKCTRL, \@b +dc); Win32::NetAdmin::GetServers($PDC, $domain, SV_TYPE_SERVER_NT, \@nt); Win32::NetAdmin::GetServers($PDC, $domain, SV_TYPE_SERVER_UNIX, \@nix) +; Win32::NetAdmin::GetServers($PDC, $domain, SV_TYPE_SQLSERVER, \@mssql) +; Win32::NetAdmin::GetServers($PDC, $domain, SV_TYPE_WORKSTATION, \@ntwk +s); Win32::NetAdmin::GetServers($PDC, $domain, SV_TYPE_WFW, \@wfw); my @dc = (@pdc, @bdc); my %nixem; my %nowks; foreach $dc (@dc) { $nowks{$dc} = "nowks"; } foreach $wfw (@wfw) { $nowks{$wfw} = "nowks"; } foreach $nix (@nix) { $nixem{$nix} = "unix"; $nowks{$nix} = "nowks"; } foreach $nt (@nt) { $nowks{$nt} = "nowks"; } print "\nNT/2000/2003 servers in the $domain domain:\n"; foreach $dc (@dc) { if ($pdc[0] eq $dc) { print "$dc (pdc)\n"; } else { print "$dc (bd +c)\n"; } } foreach $nt (@nt) { unless ($nixem{$nt} eq unix) { print "$nt\n"; } } print "\nMSSQL servers in the $domain domain:\n"; foreach $mssql (@mssql) { print "$mssql\n"; } print "\nUnix servers in the $domain domain:\n"; foreach $nix (@nix) { print "$nix\n"; } print "\nWindows NT/2000/XP workstations in the $domain domain:\n"; foreach $ntwks (@ntwks) { unless ($nowks{$ntwks} eq nowks) { print "$n +twks\n"; } } print "\nWindows 95/98 workstations in the $domain domain:\n"; foreach $wfw (@wfw) { print "$wfw\n"; }

In reply to Get Domain Members by BravoTwoZero

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.