public static void RemoveAllJobRuns(string definitionName) { if (!string.IsNullOrEmpty(definitionName)) { Collection <DateTime> jobRunsForDefinition = ScheduledJobStore.GetJobRunsForDefinition(definitionName); foreach (DateTime dateTime in jobRunsForDefinition) { string runDirectory = ScheduledJobStore.GetRunDirectory(definitionName, dateTime); Directory.Delete(runDirectory, true); } return; } else { throw new PSArgumentException("definitionName"); } }
internal static Collection <DateTime> GetJobRuns(string definitionName) { Collection <DateTime> jobRuns = null; try { jobRuns = ScheduledJobStore.GetJobRunsForDefinition(definitionName); } catch (DirectoryNotFoundException) { } catch (FileNotFoundException) { } catch (UnauthorizedAccessException) { } catch (IOException) { } return(jobRuns); }