Find files for remote machine

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • thamayanthi
    New Member
    • Feb 2008
    • 8

    Find files for remote machine

    Hi,

    I want to find all the *.Exe files for Remote machine.Is it possible to collect the information.If so, please any one help me in this.


    Thanks in Advance.
  • KevinADC
    Recognized Expert Specialist
    • Jan 2007
    • 4092

    #2
    Your question is very vague. How do you intend to connect to the remote machine to search the directories for files?

    Comment

    • thamayanthi
      New Member
      • Feb 2008
      • 8

      #3
      The following Perl Script will collect all the *.EXE file from the local machine but It is failing to collect the data from Remote machine.If any one know where iam going wrong.Please any one help me on this.......


      [CODE=perl]use strict;
      use Win32::OLE('in' );
      #use File::Find;
      use File::List;
      Win32::OLE->Option(Warn => 0);

      use constant wbemFlagReturnI mmediately => 0x10;
      use constant wbemFlagForward Only => 0x20;

      use constant iFlags => 0;


      my ($strComputer, $objSWbemLocato r, $objSWbemServic es, $colSWbemObject Set, $objWMILastErro r);

      $strComputer =@ARG[0];


      #SWbemLocator - Connect to server
      $objSWbemLocato r = Win32::OLE->new('WbemScrip ting.SWbemLocat or');

      $objSWbemServic es = $objSWbemLocato r->ConnectServer( $strComputer, 'root\\cimv2', 'domain\user', 'Password');


      #SWbemServices - ExecQuery
      $colSWbemObject Set = $objSWbemServic es->ExecQuery('SEL ECT * FROM Win32_LogicalDi sk', 'WQL', iFlags);

      if ((0 + Win32::OLE::Las tError())) {
      print '0x' . sprintf("%x", (0 + Win32::OLE::Las tError())) . ' - ' . ('' . Win32::OLE::Las tError()), "\n";
      $objWMILastErro r = Win32::OLE->new('WbemScrip ting.SWbemLastE rror');
      print 'Operation: ' . $objWMILastErro r->Operation, "\n";
      print 'ParameterInfo: ' . $objWMILastErro r->ParameterInf o, "\n";
      print 'ProviderName: ' . $objWMILastErro r->ProviderName , "\n";
      exit (1);
      }


      foreach my $objSWbemObject (in $colSWbemObject Set) {

      my ($drive,$type);

      $drive=$objSWbe mObject->{Caption};
      $type=$objSWbem Object->{DriveType};

      if($type==3)
      {
      print "$drive-$type\n";
      $drive=$drive." \\";
      my @oldFiles;

      find(\&cleanup, $drive);
      sub cleanup {
      push(@oldFiles, $File::Find::na me);
      if((/\.EXE$/)||(/\.exe$/))
      {
      #print "$_\n";
      print stdout "$File::Find::n ame\n";

      }

      }
      }

      }[/CODE]
      Last edited by eWish; Feb 22 '08, 04:28 AM. Reason: Please use [CODE][/CODE] Tags

      Comment

      Working...