From bd41c63c8b553557559ab9e899fa58b8baba410d Mon Sep 17 00:00:00 2001 From: Tadayuki Onishi Date: Mon, 24 Jun 2024 22:54:00 +0900 Subject: [PATCH] Support auto update settings for intune win32 app assignment Signed-off-by: kenchan0130 --- Public/Add-IntuneWin32AppAssignmentAllDevices.ps1 | 13 +++++++++++++ Public/Add-IntuneWin32AppAssignmentAllUsers.ps1 | 13 +++++++++++++ Public/Add-IntuneWin32AppAssignmentGroup.ps1 | 13 +++++++++++++ Public/Get-IntuneWin32AppAssignment.ps1 | 3 +++ 4 files changed, 42 insertions(+) diff --git a/Public/Add-IntuneWin32AppAssignmentAllDevices.ps1 b/Public/Add-IntuneWin32AppAssignmentAllDevices.ps1 index 02d33d2..6ddb5c4 100644 --- a/Public/Add-IntuneWin32AppAssignmentAllDevices.ps1 +++ b/Public/Add-IntuneWin32AppAssignmentAllDevices.ps1 @@ -27,6 +27,9 @@ function Add-IntuneWin32AppAssignmentAllDevices { .PARAMETER DeliveryOptimizationPriority Specify to download content in the background using default value of 'notConfigured', or set to download in foreground using 'foreground'. + .PARAMETER AutoUpdateSupersededApps + Specify to automatically update superseded app using default value of 'notConfigured'. + .PARAMETER EnableRestartGracePeriod Specify whether Restart Grace Period functionality for this assignment should be configured, additional parameter input using at least RestartGracePeriod and RestartCountDownDisplay is required. @@ -90,6 +93,11 @@ function Add-IntuneWin32AppAssignmentAllDevices { [ValidateSet("notConfigured", "foreground")] [string]$DeliveryOptimizationPriority = "notConfigured", + [parameter(Mandatory = $false, HelpMessage = "Specify to automatically update superseded app using default value of 'notConfigured'.")] + [ValidateNotNullOrEmpty()] + [ValidateSet("notConfigured", "enabled", "unknownFutureValue")] + [string]$AutoUpdateSupersededApps = "notConfigured", + [parameter(Mandatory = $false, HelpMessage = "Specify whether Restart Grace Period functionality for this assignment should be configured, additional parameter input using at least RestartGracePeriod and RestartCountDownDisplay is required.")] [ValidateNotNullOrEmpty()] [bool]$EnableRestartGracePeriod = $false, @@ -206,12 +214,17 @@ function Add-IntuneWin32AppAssignmentAllDevices { "source" = "direct" "target" = $TargetAssignment } + # Construct table for autoUpdate settings + $AutoUpdateSettings = @{ + "autoUpdateSupersededApps" = $AutoUpdateSupersededApps + } $SettingsTable = @{ "@odata.type" = "#microsoft.graph.win32LobAppAssignmentSettings" "notifications" = $Notification "restartSettings" = $null "deliveryOptimizationPriority" = $DeliveryOptimizationPriority "installTimeSettings" = $null + "autoUpdateSettings" = $AutoUpdateSettings } $Win32AppAssignmentBody.Add("settings", $SettingsTable) diff --git a/Public/Add-IntuneWin32AppAssignmentAllUsers.ps1 b/Public/Add-IntuneWin32AppAssignmentAllUsers.ps1 index 7618fac..55a24a6 100644 --- a/Public/Add-IntuneWin32AppAssignmentAllUsers.ps1 +++ b/Public/Add-IntuneWin32AppAssignmentAllUsers.ps1 @@ -27,6 +27,9 @@ function Add-IntuneWin32AppAssignmentAllUsers { .PARAMETER DeliveryOptimizationPriority Specify to download content in the background using default value of 'notConfigured', or set to download in foreground using 'foreground'. + .PARAMETER AutoUpdateSupersededApps + Specify to automatically update superseded app using default value of 'notConfigured'. + .PARAMETER EnableRestartGracePeriod Specify whether Restart Grace Period functionality for this assignment should be configured, additional parameter input using at least RestartGracePeriod and RestartCountDownDisplay is required. @@ -90,6 +93,11 @@ function Add-IntuneWin32AppAssignmentAllUsers { [ValidateSet("notConfigured", "foreground")] [string]$DeliveryOptimizationPriority = "notConfigured", + [parameter(Mandatory = $false, HelpMessage = "Specify to automatically update superseded app using default value of 'notConfigured'.")] + [ValidateNotNullOrEmpty()] + [ValidateSet("notConfigured", "enabled", "unknownFutureValue")] + [string]$AutoUpdateSupersededApps = "notConfigured", + [parameter(Mandatory = $false, HelpMessage = "Specify whether Restart Grace Period functionality for this assignment should be configured, additional parameter input using at least RestartGracePeriod and RestartCountDownDisplay is required.")] [ValidateNotNullOrEmpty()] [bool]$EnableRestartGracePeriod = $false, @@ -206,12 +214,17 @@ function Add-IntuneWin32AppAssignmentAllUsers { "source" = "direct" "target" = $TargetAssignment } + # Construct table for autoUpdate settings + $AutoUpdateSettings = @{ + "autoUpdateSupersededApps" = $AutoUpdateSupersededApps + } $SettingsTable = @{ "@odata.type" = "#microsoft.graph.win32LobAppAssignmentSettings" "notifications" = $Notification "restartSettings" = $null "deliveryOptimizationPriority" = $DeliveryOptimizationPriority "installTimeSettings" = $null + "autoUpdateSettings" = $AutoUpdateSettings } $Win32AppAssignmentBody.Add("settings", $SettingsTable) diff --git a/Public/Add-IntuneWin32AppAssignmentGroup.ps1 b/Public/Add-IntuneWin32AppAssignmentGroup.ps1 index 69c211a..9c63e92 100644 --- a/Public/Add-IntuneWin32AppAssignmentGroup.ps1 +++ b/Public/Add-IntuneWin32AppAssignmentGroup.ps1 @@ -36,6 +36,9 @@ function Add-IntuneWin32AppAssignmentGroup { .PARAMETER DeliveryOptimizationPriority Specify to download content in the background using default value of 'notConfigured', or set to download in foreground using 'foreground'. + .PARAMETER AutoUpdateSupersededApps + Specify to automatically update superseded app using default value of 'notConfigured'. + .PARAMETER EnableRestartGracePeriod Specify whether Restart Grace Period functionality for this assignment should be configured, additional parameter input using at least RestartGracePeriod and RestartCountDownDisplay is required. @@ -114,6 +117,11 @@ function Add-IntuneWin32AppAssignmentGroup { [ValidateSet("notConfigured", "foreground")] [string]$DeliveryOptimizationPriority = "notConfigured", + [parameter(Mandatory = $false, HelpMessage = "Specify to automatically update superseded app using default value of 'notConfigured'.")] + [ValidateNotNullOrEmpty()] + [ValidateSet("notConfigured", "enabled", "unknownFutureValue")] + [string]$AutoUpdateSupersededApps = "notConfigured", + [parameter(Mandatory = $false, ParameterSetName = "GroupInclude", HelpMessage = "Specify whether Restart Grace Period functionality for this assignment should be configured, additional parameter input using at least RestartGracePeriod and RestartCountDownDisplay is required.")] [ValidateNotNullOrEmpty()] [bool]$EnableRestartGracePeriod = $false, @@ -256,12 +264,17 @@ function Add-IntuneWin32AppAssignmentGroup { } switch ($PSCmdlet.ParameterSetName) { "GroupInclude" { + # Construct table for autoUpdate settings + $AutoUpdateSettings = @{ + "autoUpdateSupersededApps" = $AutoUpdateSupersededApps + } $SettingsTable = @{ "@odata.type" = "#microsoft.graph.win32LobAppAssignmentSettings" "notifications" = $Notification "restartSettings" = $null "deliveryOptimizationPriority" = $DeliveryOptimizationPriority "installTimeSettings" = $null + "autoUpdateSettings" = $AutoUpdateSettings } $Win32AppAssignmentBody.Add("settings", $SettingsTable) } diff --git a/Public/Get-IntuneWin32AppAssignment.ps1 b/Public/Get-IntuneWin32AppAssignment.ps1 index 0209bd2..33f1106 100644 --- a/Public/Get-IntuneWin32AppAssignment.ps1 +++ b/Public/Get-IntuneWin32AppAssignment.ps1 @@ -167,6 +167,8 @@ function Get-IntuneWin32AppAssignment { Notifications = $Win32AppAssignment.settings.notifications RestartSettings = $Win32AppAssignment.settings.restartSettings InstallTimeSettings = $Win32AppAssignment.settings.installTimeSettings + AutoUpdateSettings = $Win32AppAssignment.settings.autoUpdateSettings + } $Win32AppAssignmentList.Add($PSObject) | Out-Null } @@ -210,6 +212,7 @@ function Get-IntuneWin32AppAssignment { Notifications = $Win32AppAssignment.settings.notifications RestartSettings = $Win32AppAssignment.settings.restartSettings InstallTimeSettings = $Win32AppAssignment.settings.installTimeSettings + AutoUpdateSettings = $Win32AppAssignment.settings.autoUpdateSettings } $Win32AppAssignmentList.Add($PSObject) | Out-Null }