Hi Everyone

Been doing some digging into M$ site and have created a much faster code that lists the owner of each file in a given folder.

code:
$folderName = "C:\Winnt"
ShowFileList($folderName)

Function ShowFileList($folderName)
$FileList = CreateObject("Scripting.FileSystemObject").GetFolder($folderName).Files
For Each $FileListArray In $FileList
$Filename = $FolderName+"\"+$FileListArray.name
$WMIFileSecSetting = GetObject ("Winmgmts:").ExecQuery("ASSOCIATORS OF {win32_LogicalFileSecuritySetting='"+$FileName+"'}WHERE AssocClass=Win32_LogicalFileOwner ResultRole=Owner")
For Each $Object In $WMIFileSecSetting
? "FileName: "+$FileListArray.name+" Owner: "+$Object.AccountName
Next
Next
EndFunction

and a basic DirList - Looks super fast to me.

code:
$folderName = "C:\Winnt"
ShowFileList($folderName)

Function ShowFileList($folderName)
$FileList = CreateObject("Scripting.FileSystemObject").GetFolder($folderName).Files
For Each $FileListArray In $FileList

? "FileName: "+$FileListArray.name

Next
EndFunction



[ 30. August 2003, 01:44: Message edited by: Richard Farthing ]