Enumerates all the files on a computer. This is a demonstration script; if actually run, it could take an hour or more to complete, depending on the number of files on the computer. Depending on the number of files and on available memory, this script could also fail before finishing.

This script was tested using Perl 5.8.0.804 for Microsoft Windows, available from ActiveState.

Perl
Edit|Remove
use Win32::OLE('in');
use constant wbemFlagReturnImmediately => 0x10;
use constant wbemFlagForwardOnly => 0x20;

$computer = ".";
$objWMIService = Win32::OLE->GetObject
    ("winmgmts:\\\\$computer\\root\\CIMV2") or die "WMI connection failed.\n";
$colItems = $objWMIService->ExecQuery
    ("SELECT * FROM CIM_DataFile","WQL",wbemFlagReturnImmediately | wbemFlagForwardOnly);

foreach my $objItem (in $colItems)
{
      print "Access Mask: $objItem->{AccessMask}\n";
      print "Archive: $objItem->{Archive}\n";
      print "Caption: $objItem->{Caption}\n";
      print "Compressed: $objItem->{Compressed}\n";
      print "Compression Method: $objItem->{CompressionMethod}\n";
      print "Creation Class Name: $objItem->{CreationClassName}\n";
      print "Creation Date: $objItem->{CreationDate}\n";
      print "CS Creation Class Name: $objItem->{CSCreationClassName}\n";
      print "CS Name: $objItem->{CSName}\n";
      print "Description: $objItem->{Description}\n";
      print "Drive: $objItem->{Drive}\n";
      print "Eight Dot Three File Name: $objItem->{EightDotThreeFileName}\n";
      print "Encrypted: $objItem->{Encrypted}\n";
      print "Encryption Method: $objItem->{EncryptionMethod}\n";
      print "Extension: $objItem->{Extension}\n";
      print "File Name: $objItem->{FileName}\n";
      print "File Size: $objItem->{FileSize}\n";
      print "File Type: $objItem->{FileType}\n";
      print "FS Creation Class Name: $objItem->{FSCreationClassName}\n";
      print "FS Name: $objItem->{FSName}\n";
      print "Hidden: $objItem->{Hidden}\n";
      print "Install Date: $objItem->{InstallDate}\n";
      print "In Use Count: $objItem->{InUseCount}\n";
      print "Last Accessed: $objItem->{LastAccessed}\n";
      print "Last Modified: $objItem->{LastModified}\n";
      print "Manufacturer: $objItem->{Manufacturer}\n";
      print "Name: $objItem->{Name}\n";
      print "Path: $objItem->{Path}\n";
      print "Readable: $objItem->{Readable}\n";
      print "Status: $objItem->{Status}\n";
      print "System: $objItem->{System}\n";
      print "Version: $objItem->{Version}\n";
      print "Writeable: $objItem->{Writeable}\n";
      print "\n";
}