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
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions Sources/Policies/ADMX/WAU.admx
Original file line number Diff line number Diff line change
Expand Up @@ -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>

<elements>
<enum id="DayofWeek" valueName="WAU_DayofWeek">
<item displayName="$(string.DayofWeek_Monday)">
<value>
<string>Monday</string>
</value>
</item>
<item displayName="$(string.DayofWeek_Tuesday)">
<value>
<string>Tuesday</string>
</value>
</item>
<item displayName="$(string.DayofWeek_Wednesday)">
<value>
<string>Wednesday</string>
</value>
</item>
<item displayName="$(string.DayofWeek_Thursday)">
<value>
<string>Thursday</string>
</value>
</item>
<item displayName="$(string.DayofWeek_Friday)">
<value>
<string>Friday</string>
</value>
</item>
<item displayName="$(string.DayofWeek_Saturday)">
<value>
<string>Saturday</string>
</value>
</item>
<item displayName="$(string.DayofWeek_Sunday)">
<value>
<string>Sunday</string>
</value>
</item>
</enum>
</elements>
</policy>
</policies>
</policyDefinitions>
23 changes: 22 additions & 1 deletion Sources/Policies/ADMX/en-US/WAU.adml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<policyDefinitionResources xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" revision="4.8" schemaVersion="1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" revision="4.9" schemaVersion="1.0"
xmlns="http://schemas.microsoft.com/GroupPolicy/2006/07/PolicyDefinitions">
<displayName>WinGet-AutoUpdate</displayName>
<description>WinGet-AutoUpdate GPO Management</description>
Expand Down Expand Up @@ -107,6 +107,24 @@
<string id="UpdatesInterval_Monthly">5. Monthly</string>
<string id="UpdatesInterval_Never">6. Never (e.g. in combination with 'Updates
Interval')</string>
<string id="DayofWeek_Name">Updates Day of Week (e.g. in combination with 'Updates Interval Weekly')</string>
<string id="DayofWeek_Explain">If this policy is enabled, you can configure the day of the week updates are run:
1. Monday (Default)
2. Tuesday
3. Wednesday
4. Thursday
5. Friday
6. Saturday
7. Sunday

If this policy is not configured or disabled, the default day is Monday.</string>
<string id="DayofWeek_Monday">1. Monday (Default)</string>
<string id="DayofWeek_Tuesday">2. Tuesday</string>
<string id="DayofWeek_Wednesday">3. Wednesday</string>
<string id="DayofWeek_Thursday">4. Thursday</string>
<string id="DayofWeek_Friday">5. Friday</string>
<string id="DayofWeek_Saturday">6. Saturday</string>
<string id="DayofWeek_Sunday">7. Sunday</string>
<string id="UpdatesAtLogon_Name">Updates at Logon</string>
<string id="UpdatesAtLogon_Explain">This policy setting specifies whether to set
WAU to run at user logon or not.
Expand Down Expand Up @@ -214,6 +232,9 @@
<presentation id="UpdatesInterval">
<dropdownList refId="UpdatesInterval" />
</presentation>
<presentation id="DayofWeek">
<dropdownList refId="DayofWeek"/>
</presentation>
<presentation id="UpdatesAtTime">
<dropdownList refId="UpdatesAtTime" />
</presentation>
Expand Down
23 changes: 22 additions & 1 deletion Sources/Policies/ADMX/fr-FR/WAU.adml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<policyDefinitionResources xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" revision="4.8" schemaVersion="1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" revision="4.9" schemaVersion="1.0"
xmlns="http://schemas.microsoft.com/GroupPolicy/2006/07/PolicyDefinitions">
<displayName>WinGet-AutoUpdate</displayName>
<description>Gestion GPO de WinGet-AutoUpdate</description>
Expand Down Expand Up @@ -126,6 +126,24 @@
<string id="UpdatesInterval_Monthly">5. Mensuel</string>
<string id="UpdatesInterval_Never">6. Jamais (par exemple, en combinaison avec 'Intervalle de
mise à jour')</string>
<string id="DayofWeek_Name">Jour des mises à jour (par exemple, en combinaison avec 'Intervalle des mises à jour hebdomadaire')</string>
<string id="DayofWeek_Explain">Si cette stratégie est activée, vous pouvez configurer le jour de la semaine où les mises à jour sont effectuées :
1. Lundi (Par défaut)
2. Mardi
3. Mercredi
4. Jeudi
5. Vendredi
6. Samedi
7. Dimanche

Si cette stratégie n'est pas configurée ou est désactivée, le jour par défaut est le lundi.</string>
<string id="DayofWeek_Monday">1. Lundi (Par défaut)</string>
<string id="DayofWeek_Tuesday">2. Mardi</string>
<string id="DayofWeek_Wednesday">3. Mercredi</string>
<string id="DayofWeek_Thursday">4. Jeudi</string>
<string id="DayofWeek_Friday">5. Vendredi</string>
<string id="DayofWeek_Saturday">6. Samedi</string>
<string id="DayofWeek_Sunday">7. Dimanche</string>
<string id="UpdatesAtLogon_Name">Mises à jour à la connexion</string>
<string id="UpdatesAtLogon_Explain">
Ce paramètre de politique spécifie s'il faut configurer WAU pour s'exécuter à la connexion
Expand Down Expand Up @@ -247,6 +265,9 @@
<presentation id="UpdatesInterval">
<dropdownList refId="UpdatesInterval" />
</presentation>
<presentation id="DayofWeek">
<dropdownList refId="DayofWeek"/>
</presentation>
<presentation id="UpdatesAtTime">
<dropdownList refId="UpdatesAtTime" />
</presentation>
Expand Down
18 changes: 15 additions & 3 deletions Sources/Winget-AutoUpdate/WAU-Policies.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,25 @@ if ($WAUConfig.WAU_RunGPOManagement -eq 1) {
$tasktriggers += New-ScheduledTaskTrigger -Daily -At $WAUConfig.WAU_UpdatesAtTime -DaysInterval 2
}
elseif ($WAUConfig.WAU_UpdatesInterval -eq "Weekly") {
$tasktriggers += New-ScheduledTaskTrigger -Weekly -At $WAUConfig.WAU_UpdatesAtTime -DaysOfWeek 2
if ($WAUConfig.WAU_DayofWeek) {
$tasktriggers += New-ScheduledTaskTrigger -Weekly -At $WAUConfig.WAU_UpdatesAtTime -DaysOfWeek $WAUConfig.WAU_DayofWeek
} else {
$tasktriggers += New-ScheduledTaskTrigger -Weekly -At $WAUConfig.WAU_UpdatesAtTime -DaysOfWeek 2
}
}
elseif ($WAUConfig.WAU_UpdatesInterval -eq "BiWeekly") {
$tasktriggers += New-ScheduledTaskTrigger -Weekly -At $WAUConfig.WAU_UpdatesAtTime -DaysOfWeek 2 -WeeksInterval 2
if ($WAUConfig.WAU_DayofWeek) {
$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
if ($WAUConfig.WAU_DayofWeek) {
$tasktriggers += New-ScheduledTaskTrigger -Weekly -At $WAUConfig.WAU_UpdatesAtTime -DaysOfWeek $WAUConfig.WAU_DayofWeek -WeeksInterval 4
} else {
$tasktriggers += New-ScheduledTaskTrigger -Weekly -At $WAUConfig.WAU_UpdatesAtTime -DaysOfWeek 2 -WeeksInterval 4
}
}
#If trigger(s) set
if ($taskTriggers) {
Expand Down