private void makeConfigDirectory() { var ds = new DirectorySecurity(); ds.SetSecurityDescriptorSddlForm("O:BAG:BAD:PAI(A;OICI;FA;;;BA)(A;OICI;FA;;;SY)"); FileSystemAclExtensions.CreateDirectory(ds, userDirectory); }
static double PowershellExecutionTimeout = 15; // In Minutes static void Main(string[] args) { Console.WriteLine("Agent running..."); globalLog.WriteLine($"[{DateTime.Now}] Starting Agent..."); DirectorySecurity dirSec = new DirectorySecurity(); FileSystemAccessRule administratorSecurityRule = new FileSystemAccessRule("Administrators", FileSystemRights.FullControl, InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit, PropagationFlags.None, AccessControlType.Allow); dirSec.AddAccessRule(administratorSecurityRule); FileSystemAclExtensions.CreateDirectory(dirSec, dataFolder); var scriptID = "39866b17-38c4-43a9-bb78-0aeea286d592"; var scriptRaw = "V3JpdGUtSG9zdCAnSGVsbG8sIFdvcmxkISc="; LoadScript(scriptID, scriptRaw); ExecuteScript(scriptID); globalLog.Close(); }