Dear Monks,
I have created a perl script (say script #1) which can create a report from an individual machine and keep the report file at a specified location on the same PC.

In my organization around 100+ PCs are connected to a domain. I have written another script (say script #2) to copy the said report from PC and add the report' data to a database.
My probelm is I don't know that at a given moment, when I run script #2, how many PCs are connected to network. Is there any way where I can get IP addresses/Names of all the PCs connected to Network when I run script #2, so that I can scan those PCs and add their reports to database?

Regards,
Sandeep

Update:- Dear Monks,
I would like to thanks all of you for helping me, Meanwhile I got some other code, which has solved my problem, I would like to share that code with you.
use Socket; use Win32::Lanman; Domains_im_Netz(); foreach $domain (@Domains) {Win32::Lanman::NetServerEnum( '', $domain, SV_TYPE_ALL, \@W1); foreach (@W1) {$hostname = ${$_}{'name'}; my $ip = gethostbyname($hostname); if ( defined $ip ) {print "$domain\t", inet_ntoa($ip), "\t $hostname\n";} } } sub Domains_im_Netz {# zeigt die Domainen im Netzwerk an use Win32::OLE; @Domains = (); $dom = Win32::OLE->GetObject("WinNT:"); foreach $AG (in $dom) {if ($AG->{Name} eq 'TRUMPF' ) {next;} push @Domains, $AG->{Name}; } } ## Domains_im_Netz # end code

In reply to How can get all the terminal names/IP addresses connected to network by sanPerl

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.