static int Main(string[] args) { int rc = 0; if (SecurityAPI.is_user_admin()) { PatchAutomate automate = new PatchAutomate(); automate.config = new CliConfig(config_types.PatchAutomation); CliInit init; if (args.Length == 1 && args[0].StartsWith("/config=")) { init = new CliInit(CliInit.GetConfigFromFile(ref args), ref automate.config); } else { init = new CliInit(args, ref automate.config); } EventLog.ReportInfo(init.DumpConfig(config_types.PatchAutomation)); if (init.ParseArgs()) { _debug = automate.config.Debug; Console.WriteLine("PatchAutomate starting."); EventLog.ReportInfo("Symantec BCS PatchAutomate is starting."); try { rc = automate.RunAutomation(); } catch (Exception e) { LoggingAPI.ReportException(e); rc = -2; } } else { if (automate.config.Print_Version) { Console.WriteLine("{{CWoC}} PatchAutomation version {0}", Constant.VERSION); return(0); } Console.WriteLine(Constant.PATCH_AUTOMATE_HELP); if (!automate.config.Help_Needed) { EventLog.ReportInfo("PatchAutomate invocation incorrect. Printed command line help and returned -1."); return(-1); } return(0); } if (rc == 0) { LoggingAPI.ReportInfo("PatchAutomate execution completed. See you soon..."); } } else { LoggingAPI.ReportInfo("Access denied - Only Administrators are allowed to use this tool. This entry will be recorded in the Altiris Server logs."); rc = -1; } return(rc); }