Windows Perl Scripting Forums » Perl

Help With a couple things please

(1 post)
  • Started 11 years ago by TSgt_Mad

Tags:


  1. TSgt_Mad
    Member

    OK, this may be better suited for VBScript, but i thought it would be a good challenge since i dont have a lot of experience in PERL but need to learn....

    FYI i will be using the Win32 objects since it is a complete windows domain minus a few boxes. the UNIX/LINUX part we can build later 8-O

    What I am trying to do is write some code to:

    1. enumerate the boxes running the server service on my domain
    2. Connect to specified WMI methods such as Win32_PhysicalMemory, Win32_Processor, and Win32_NetworkAdapter.
    3. Read these values and write them to an Excel sheet

    Here is what I have so far:

    use Strict;
    use Win32;
    use Win32::NetAdmin;
    use Win32::OLE qw (in);
    #use
    #Connect to the array of servers
    my@List;
    my@Domain = shift@ARGV || Win32::DomainName();
       if (Win32::NetAdmin::GetServers ('', $Domain, SV_TYPE_SERVER, \@List))
          {
             my $icount;
                print 'The Servers in the $Domain are:\n';
             map;
             
          }
    #Query the array of Win32_Properies

    #$Value

    @Win32 = ('Win32_PhysicalMemory','Win32_Processor','Win32_NetworkAdapter');
       foreach $Value(@Win32[0],@Win32[1],@Win32[2])
          printf "The memory is:",(@Win32[0]), "/n";
          printf "The Processor is:",(@Win32[1]), "/n";
          printf "The Network Adapter Information is:",(@Win32[2]),"/n";



    so far i get syntax errors all over the place and i have not even messed with the OLE excel portion yet.

    can someone help? Am i even on the right track? I have Mr Roth's second version of the book, which has been a huge help so far....

    Thanks

    JM
    Posted 11 years ago #

RSS feed for this topic

Reply

You must log in to post.