Does anybody knows, how can I change access rules to file for some users (SID) from Active Directory?
I'm signed by User1 in domain. In this domain is SuperUser (Administrator) in AD. I have pass of this account.
I want to change access rules to file via SuperUser while signed by User1
try
Dim strUSER As String = "superuser"
Dim strPASSWORD As String = "qwerty123456"
Dim strDOMAIN As String = System.Net.NetworkInformation.IPGlobalProperties.GetIPGlobalProperties().DomainName
If Not String.IsNullOrEmpty(strDOMAIN) Then
Dim myDirectoryEntry As DirectoryEntry = New DirectoryEntry(strDOMAIN, strUSER, strPASSWORD, AuthenticationTypes.Secure)
End If
Dim fileName As String = "Z:\Data\Letters\Out\123.pdf"
Console.WriteLine("Adding access control entry for " & fileName)
AddFileSecurity(fileName, "DOMAIN\user2", FileSystemRights.Write, AccessControlType.Allow)
Console.WriteLine("Removing access control entry from " & fileName)
Catch e As Exception
MsgBox(e.Message)
End Try
I found this code which can take me a token of authentification
What can I do with it?...