Skip to content
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

New Feature: Select Day of Week #839

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from

Conversation

tristancurtis97
Copy link

Proposed Changes

"Day of Week" feature. This allows you to specify the day of the week updates are run on using the Weekly or Bi-Weekly policy. If the Weekly or Bi-Weekly policy is selected, the policy script will check the DayofWeek registry value and update the schedule task appropriately. I also updated the ADMX and both English and French ADML files to allow for the new change.

Related Issues

(Github link to related issues or pull requests)

@@ -420,5 +420,48 @@
<text id="WingetSourceCustom" valueName="WAU_WingetSourceCustom" />
</elements>
</policy>
<policy name="DayofWeek_Enable" class="Machine" displayName="$(string.DayofWeek_Name)" explainText="$(string.DayofWeek_Explain)" key="Software\Policies\Romanitho\Winget-AutoUpdate" presentation="$(presentation.DayofWeek)">
<parentCategory ref="WAU"/>
<supportedOn ref="WAU:SUPPORTED_WAU_1_16_0"/>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

supported version shout be the next one?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to 1_16_5, is that correct?

$tasktriggers += New-ScheduledTaskTrigger -Weekly -At $WAUConfig.WAU_UpdatesAtTime -DaysOfWeek $WAUConfig.WAU_DayofWeek -WeeksInterval 2
} else {
$tasktriggers += New-ScheduledTaskTrigger -Weekly -At $WAUConfig.WAU_UpdatesAtTime -DaysOfWeek 2 -WeeksInterval 2
}
}
elseif ($WAUConfig.WAU_UpdatesInterval -eq "Monthly") {
$tasktriggers += New-ScheduledTaskTrigger -Weekly -At $WAUConfig.WAU_UpdatesAtTime -DaysOfWeek 2 -WeeksInterval 4
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could it be also possible to choose the day for a "monthly" as well?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anyway, for the monthly trigger, I need to review it to make it more accurate than just running every 4 weeks.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked into it, and you can do it utilizing schtasks.exe, but i noticed anti malware software does not like that, so hopefully someone other than me can come up with a solution, as I would love to be able to choose what day of the month the updates run on.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated this to use the dayofweek in the monthy selection as well.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@KnifMelti
Copy link
Contributor

Don't forget to increase the revisions of the files in the headers so that the files are actually imported correctly in AD!
ADMX right now: revision="4.9"
ADML right now: revision="4.8"

@Romanitho Romanitho changed the base branch from main to develop February 22, 2025 22:19
@@ -420,5 +420,48 @@
<text id="WingetSourceCustom" valueName="WAU_WingetSourceCustom" />
</elements>
</policy>
<policy name="DayofWeek_Enable" class="Machine" displayName="$(string.DayofWeek_Name)" explainText="$(string.DayofWeek_Explain)" key="Software\Policies\Romanitho\Winget-AutoUpdate" presentation="$(presentation.DayofWeek)">
<parentCategory ref="WAU"/>
<supportedOn ref="WAU:SUPPORTED_WAU_1_16_5"/>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the next WAU version should be here, @KnifMelti?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ADMX/ADML is a mess to handle.
The one proposed is already in the header of ADMX and introducing something new must be mirrored in those strings:

  <supportedOn>
    <definitions>
      <definition name="SUPPORTED_WAU_1_16_0" displayName="$(string.SUPPORTED_WAU_1_16_0)" />
      <definition name="SUPPORTED_WAU_1_16_5" displayName="$(string.SUPPORTED_WAU_1_16_5)" />
      <definition name="SUPPORTED_WAU_EXPERIMENTAL"
        displayName="$(string.SUPPORTED_WAU_EXPERIMENTAL)" />
    </definitions>
  </supportedOn>
  <categories>
    <category displayName="$(string.WAU)" name="WAU" />
    <category name="Experimental" displayName="$(string.WAUEX)">
      <parentCategory ref="WAU" />
    </category>
  </categories>

ADML(en-US):

      <string id="WAU">Winget-AutoUpdate</string>
      <string id="WAUEX">Experimental</string>
      <string id="SUPPORTED_WAU_1_16_0">Winget-AutoUpdate version 1.16.0 or later</string>
      <string id="SUPPORTED_WAU_1_16_5">Winget-AutoUpdate version 1.16.5 or later</string>
      <string id="SUPPORTED_WAU_EXPERIMENTAL">Winget-AutoUpdate Experimental, subject to change, do
        not use on PROD</string>

ADML(fr-FR):

      <string id="WAU">Winget-AutoUpdate</string>
      <string id="WAUEX">Expérimental</string>
      <string id="SUPPORTED_WAU_1_16_0">Winget-AutoUpdate version 1.16.0 ou ultérieure</string>
      <string id="SUPPORTED_WAU_1_16_5">Winget-AutoUpdate version 1.16.5 ou ultérieure</string>
      <string id="SUPPORTED_WAU_EXPERIMENTAL">Winget-AutoUpdate Expérimental, sujet à changements,
        ne pas utiliser en PROD</string>

@KnifMelti
Copy link
Contributor

And.. ..evrytime the files are ment to be imported into AD the revisions must be increased if there's been a change in them.
Meaning that in this case I would increase both the ADMX and the ADML to for example revision="5.0"

@KnifMelti
Copy link
Contributor

KnifMelti commented Feb 23, 2025

If I may elaborate on this, I don't understand why there is a second WAU.adml (fr-FR) at all. It only complicates synchronization. I have not encountered anyone with a localized Domain Controller (DC) in their Active Directory; it is always en-US (when seeking help online, searching for GPO settings, troubleshooting, etc.). Who will translate the ADML files and keep them synchronized?

@Romanitho
Copy link
Owner

I agree. It will be harder to maintain. Google Translate or ChatGPT can help administrators if necessary 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants