I have noticed not a lot of people know how to get the basic IO.file Owner information of a file/dir so i will show an example that you can play around with.
'Required for The Directory Query.
'Required for The NT User Account Query.
Code: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.
Hope this helps anyone who is looking.Code: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
Cheers
-Sharper Software
The Future Of Network Defense Systems, Today.
Nice work on this man,
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks