Okay.. here is my code.. it probably needs to be cleaned up a bit.. and maybe reworked for your needs.. but what it does is create a file that lists the filename with the ownership..

code:
break on

Function GetOwner($fileinput)
$wmiobj = GetObject("Winmgmts:")
$SIDobj = $wmiobj.ExecQuery("ASSOCIATORS OF {win32_LogicalFileSecuritySetting='$fileinput'}
WHERE AssocClass=Win32_LogicalFileOwner ResultRole=Owner")
For each $SID in $SIDobj
$GetOwner=$SID.ReferencedDomainName+"\"+$SID.AccountName
Next
EndFunction


$fileOutput = "i:\owners.txt" ; place to store the owner list
$dir = "m:\" ; directory path. UNC names not supported. Must end in "\"

$ok = RedirectOutput($fileoutput)
$filename = DIR($dir)
While $filename <> "" AND @error = 0
$file = $dir+$filename
$owner = GetOwner($file)
? $file+" "+$owner
$filename = DIR()
Loop
$ok = RedirectOutput("")

If you need it cleaned up to perform tasks based on owner and you need help with that, let me know.

Brian

[ 21 June 2002, 17:58: Message edited by: BrianTX ]