C# Change directory acccess from non administrator user with administrator password

  administrator, c++, directory, windows

I need to change permision of the shared directory which is on my domain, from "Read and execute" to "Full control" from my C# windows application. The application is started from non administrator user. Becasue of this I understand that i can’t change the permision via standart method:

DirectoryInfo dInfo = new DirectoryInfo(FileName);
           DirectorySecurity dSecurity = dInfo.GetAccessControl();
           dSecurity.AddAccessRule(new FileSystemAccessRule(Account,
           Rights,
           ControlType));
           dInfo.SetAccessControl(dSecurity);

Is there any way my application (started from non administraotr user) to use administrator password (like string) to change directory permision?

Thank you!

Source: Windows Questions

LEAVE A COMMENT