-
Notifications
You must be signed in to change notification settings - Fork 29
BREAKING CHANGE: UpdateServicesDsc: Add new parameters, do not apply undefined parameters, bug fixes #95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
BREAKING CHANGE: UpdateServicesDsc: Add new parameters, do not apply undefined parameters, bug fixes #95
Changes from 9 commits
e57cc1b
e13264f
f974ef8
ed62b2d
8000118
182dfd5
29fcdaf
7ed0bce
362350a
919beed
1144564
e7f513f
d158d2e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -66,7 +66,7 @@ function Get-TargetResource | |
| } | ||
| } | ||
| } | ||
| $TimeOfDay = $Task.Triggers.StartBoundary.Split('T')[1] | ||
| $TimeOfDay = ([datetimeoffset]$Task.Triggers[0].StartBoundary).TimeOfDay.ToString('c') | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add error handling for potential null reference and parsing errors. The code accesses Consider wrapping this in a try-catch block or adding validation: - $TimeOfDay = ([datetimeoffset]$Task.Triggers[0].StartBoundary).TimeOfDay.ToString('c')
+ if ($Task.Triggers -and $Task.Triggers.Count -gt 0)
+ {
+ try
+ {
+ $TimeOfDay = ([datetimeoffset]$Task.Triggers[0].StartBoundary).TimeOfDay.ToString('c')
+ }
+ catch
+ {
+ Write-Verbose -Message "Failed to parse TimeOfDay from scheduled task trigger."
+ }
+ }
🤖 Prompt for AI Agents |
||
| } | ||
| else | ||
| { | ||
|
|
@@ -363,6 +363,12 @@ function Test-TargetResource | |
| Write-Verbose -Message $script:localizedData.CleanupPublishedTestFailed | ||
| $result = $false | ||
| } | ||
|
|
||
| if ($CleanupTask.TimeOfDay -ne $TimeOfDay) | ||
| { | ||
| Write-Verbose -Message $script:localizedData.TimeOfDayTestFailed | ||
| $result = $false | ||
| } | ||
| } | ||
|
|
||
| $result | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.