I've written a script in which I'm doing wmi calls via OLE.
Is there any OLE cleanup I should be doing prior to leaving the subroutine?
Thanks.



my ($sysname) = @_;
my ($WMI,$class, $OSdata, $item);
eval
   {
       $class = "WinMgmts:{impersonationLevel=impersonate}!//$sysname";
      unless ($WMI = Win32::OLE-> GetObject( $class ))
         {
         print "Error creating WMI Object on $sysname \n";
          }

      ## WMI looks good so execute the OS query

      $OSdata = $WMI-> ExecQuery("SELECT * FROM Win32_OperatingSystem");
      foreach  $item (in $OSdata)
         {
         print "$sysname is running $item->{Caption} - $item->{Version} -
Service Pack Level
$item->{ServicePackMajorVersion}.$item->{ServicePackMinorVersion}\n";

         }

   };

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to