I need to pull the owner of a file from the folder attributes

I need to pull the owner of the file with the file name. I can get the file name and write it to a csv but i also need the owner attribute. How do I pull this information? I have the owner attribute enabled but am not sure how to pull the information.

You can do like this:

Dim fi As New FileInfo(fileName)
Dim fs As System.Security.AccessControl.FileSecurity = fi.GetAccessControl
Dim owner As System.Security.Principal.NTAccount = CType(fs.GetOwner(GetType(System.Security.Principal.NTAccount)), System.Security.Principal.NTAccount)
Return owner.ToString

This is what I have currently in assign. directory.GetFiles("\\myservername\D_box_1$\G0", "*.PDF")

How do I add that to pull the file name and owner at the same time?

where i put fileName you will use the item out of your for each…