Sub Macro1()
Dim xFileSystemObject As Object
Dim xFolder As Object
Dim xSubFolder As Object
Dim vFolderName As String, sLongFilename As String
Dim xFile
vFolderName = "\\server\folder\Lockout\"
Set xFileSystemObject = CreateObject("Scripting.FileSystemObject")
Set xFolder = xFileSystemObject.GetFolder(vFolderName)
For Each xFile In xFolder.Files
MsgBox GetFileOwner(vFolderName, xFile.Name), , xFile.Name
Next
End Sub
Function GetFileOwner(fileDir As String, fileName As String) As String
Dim securityUtility As Object
Dim securityDescriptor As Object
Set securityUtility = CreateObject("ADsSecurityUtility")
Set securityDescriptor = securityUtility.GetSecurityDescriptor(fileDir & fileName, 1, 1)
GetFileOwner = securityDescriptor.Owner
End Function