private static string GetRunDirectory(string definitionName, DateTime runStart)
        {
            string jobRunOutputDirectory = ScheduledJobStore.GetJobRunOutputDirectory(definitionName);

            object[] jobRunName = new object[2];
            jobRunName[0] = jobRunOutputDirectory;
            jobRunName[1] = ScheduledJobStore.ConvertDateTimeToJobRunName(runStart);
            return(string.Format(CultureInfo.InvariantCulture, OSHelper.IsUnix ? "{0}/{1}" : "{0}\\{1}", jobRunName));
        }
 public static Collection <DateTime> GetJobRunsForDefinition(string definitionName)
 {
     if (!string.IsNullOrEmpty(definitionName))
     {
         string jobRunOutputDirectory = ScheduledJobStore.GetJobRunOutputDirectory(definitionName);
         return(ScheduledJobStore.GetJobRunsForDefinitionPath(jobRunOutputDirectory));
     }
     else
     {
         throw new PSArgumentException("definitionName");
     }
 }
        private static string GetRunFilePathName(string definitionName, ScheduledJobStore.JobRunItem runItem, DateTime runStart)
        {
            string jobRunOutputDirectory = ScheduledJobStore.GetJobRunOutputDirectory(definitionName);

            object[] jobRunName = new object[2];
            jobRunName[0] = jobRunOutputDirectory;
            jobRunName[1] = ScheduledJobStore.ConvertDateTimeToJobRunName(runStart);
            string str = string.Format(CultureInfo.InvariantCulture, OSHelper.IsUnix ? "{0}/{1}" : "{0}\\{1}", jobRunName);

            object[] objArray = new object[2];
            objArray[0] = str;
            objArray[1] = runItem.ToString();
            return(string.Format(CultureInfo.InvariantCulture, OSHelper.IsUnix ? "{0}/{1}.xml" : "{0}\\{1}.xml", objArray));
        }
        private static string CreateFilePathName(string definitionName, string fileName)
        {
            string jobDefinitionPath     = ScheduledJobStore.GetJobDefinitionPath(definitionName);
            string jobRunOutputDirectory = ScheduledJobStore.GetJobRunOutputDirectory(definitionName);

            if (!Directory.Exists(jobDefinitionPath))
            {
                Directory.CreateDirectory(jobDefinitionPath);
                Directory.CreateDirectory(jobRunOutputDirectory);
                object[] objArray = new object[2];
                objArray[0] = jobDefinitionPath;
                objArray[1] = fileName;
                return(string.Format(CultureInfo.InstalledUICulture, (OSHelper.IsUnix ? "{0}/{1}.xml" : "{0}\\{1}.xml"), objArray));
            }
            else
            {
                ScheduledJobException scheduledJobException = new ScheduledJobException(StringUtil.Format(ScheduledJobErrorStrings.JobDefFileAlreadyExists, definitionName));
                scheduledJobException.FQEID = "ScheduledJobDefExists";
                throw scheduledJobException;
            }
        }
        public static void SetWriteAccessOnJobRunOutput(string definitionName, string user)
        {
            string jobRunOutputDirectory = ScheduledJobStore.GetJobRunOutputDirectory(definitionName);

            ScheduledJobStore.AddFullAccessToDirectory(user, jobRunOutputDirectory);
        }