'Required for The Directory Query.
'Required for The NT User Account Query.
Imports System.IO Imports System.Security Imports System.Security.Principal
Just Add this to a form, and add a reference to it in the form load events or a button event.
Public sub getowner()
Try
Dim Target_Dir as string
Dim di As New DirectoryInfo(Target_Dir)
Dim ds As AccessControl.DirectorySecurity = di.GetAccessControl()
Dim owner As NTAccount = CType(ds.GetOwner(GetType(NTAccount)), NTAccount)
msgbox("File Owner: " & owner.ToString)
Catch ex As Exception
msgbox("File Owner Error: " & ex.Message)
End Try
end sub
Hope this helps anyone who is looking.
Cheers
-Sharper Software
The Future Of Network Defense Systems, Today.


Sign In
Create Account


Back to top









