@@ -520,28 +520,28 @@ function Set-TargetResource
520520
521521 if ($RepetitionDuration -lt $RepeatInterval )
522522 {
523- New-InvalidArgumentException `
523+ New-ArgumentException `
524524 - Message ($script :localizedData.RepetitionDurationLessThanIntervalError -f $RepetitionDuration , $RepeatInterval ) `
525525 - ArgumentName RepeatInterval
526526 }
527527
528528 if ($ScheduleType -eq ' Daily' -and $DaysInterval -eq 0 )
529529 {
530- New-InvalidArgumentException `
530+ New-ArgumentException `
531531 - Message ($script :localizedData.DaysIntervalError -f $DaysInterval ) `
532532 - ArgumentName DaysInterval
533533 }
534534
535535 if ($ScheduleType -eq ' Weekly' -and $WeeksInterval -eq 0 )
536536 {
537- New-InvalidArgumentException `
537+ New-ArgumentException `
538538 - Message ($script :localizedData.WeeksIntervalError -f $WeeksInterval ) `
539539 - ArgumentName WeeksInterval
540540 }
541541
542542 if ($ScheduleType -eq ' Weekly' -and $DaysOfWeek.Count -eq 0 )
543543 {
544- New-InvalidArgumentException `
544+ New-ArgumentException `
545545 - Message ($script :localizedData.WeekDayMissingError ) `
546546 - ArgumentName DaysOfWeek
547547 }
@@ -554,29 +554,29 @@ function Set-TargetResource
554554 }
555555 catch
556556 {
557- New-InvalidArgumentException `
557+ New-ArgumentException `
558558 - Message ($script :localizedData.OnEventSubscriptionError ) `
559559 - ArgumentName EventSubscription
560560 }
561561 }
562562
563563 if ($ScheduleType -eq ' OnSessionState' -and [System.String ]::IsNullOrEmpty($StateChange ))
564564 {
565- New-InvalidArgumentException `
565+ New-ArgumentException `
566566 - Message ($script :localizedData.OnSessionStateChangeError ) `
567567 - ArgumentName StateChange
568568 }
569569
570570 if ($ExecuteAsGMSA -and ($ExecuteAsCredential -or $BuiltInAccount ))
571571 {
572- New-InvalidArgumentException `
572+ New-ArgumentException `
573573 - Message ($script :localizedData.gMSAandCredentialError ) `
574574 - ArgumentName ExecuteAsGMSA
575575 }
576576
577577 if ($SynchronizeAcrossTimeZone -and ($ScheduleType -notin @ (' Once' , ' Daily' , ' Weekly' )))
578578 {
579- New-InvalidArgumentException `
579+ New-ArgumentException `
580580 - Message ($script :localizedData.SynchronizeAcrossTimeZoneInvalidScheduleType ) `
581581 - ArgumentName SynchronizeAcrossTimeZone
582582 }
@@ -832,7 +832,7 @@ function Set-TargetResource
832832
833833 if ($RepetitionDuration -le $RepeatInterval )
834834 {
835- New-InvalidArgumentException `
835+ New-ArgumentException `
836836 - Message ($script :localizedData.RepetitionIntervalError -f $RepeatInterval , $RepetitionDuration ) `
837837 - ArgumentName RepetitionDuration
838838 }
0 commit comments