Skip to content

Commit 0a2d233

Browse files
committed
feat: support windowsQualityUpdatePolicies and windowsQualityUpdateProfiles
1 parent ea92699 commit 0a2d233

File tree

5 files changed

+68
-1
lines changed

5 files changed

+68
-1
lines changed

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-ListIntunePolicy.ps1

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,16 @@ Function Invoke-ListIntunePolicy {
4343
method = 'GET'
4444
url = "/deviceManagement/windowsFeatureUpdateProfiles?`$expand=assignments&top=200"
4545
}
46+
@{
47+
id = 'windowsQualityUpdatePolicies'
48+
method = 'GET'
49+
url = "/deviceManagement/windowsQualityUpdatePolicies?`$expand=assignments&top=200"
50+
}
51+
@{
52+
id = 'windowsQualityUpdateProfiles'
53+
method = 'GET'
54+
url = "/deviceManagement/windowsQualityUpdateProfiles?`$expand=assignments&top=200"
55+
}
4656
@{
4757
id = 'GroupPolicyConfigurations'
4858
method = 'GET'
@@ -78,6 +88,8 @@ Function Invoke-ListIntunePolicy {
7888
'*microsoft.graph.macOSEndpointProtectionConfiguration*' { 'MacOS Endpoint Protection' }
7989
'*microsoft.graph.androidWorkProfileGeneralDeviceConfiguration*' { 'Android Configuration' }
8090
'*windowsFeatureUpdateProfiles*' { 'Feature Update' }
91+
'*windowsQualityUpdatePolicies*' { 'Quality Update' }
92+
'*windowsQualityUpdateProfiles*' { 'Quality Update' }
8193
'*iosUpdateConfiguration*' { 'iOS Update Configuration' }
8294
'*windowsDriverUpdateProfiles*' { 'Driver Update' }
8395
'*configurationPolicies*' { 'Device Configuration' }

Modules/CIPPCore/Public/New-CIPPBackupTask.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ function New-CIPPBackupTask {
4141
"https://graph.microsoft.com/beta/deviceAppManagement/mobileAppConfigurations?`$expand=assignments&`$filter=microsoft.graph.androidManagedStoreAppConfiguration/appSupportsOemConfig%20eq%20true"
4242
'https://graph.microsoft.com/beta/deviceManagement/configurationPolicies'
4343
'https://graph.microsoft.com/beta/deviceManagement/windowsFeatureUpdateProfiles'
44+
'https://graph.microsoft.com/beta/deviceManagement/windowsQualityUpdatePolicies'
45+
'https://graph.microsoft.com/beta/deviceManagement/windowsQualityUpdateProfiles'
4446
)
4547

4648
$Policies = foreach ($url in $GraphURLS) {

Modules/CIPPCore/Public/New-CIPPIntuneTemplate.ps1

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,18 @@ function New-CIPPIntuneTemplate {
103103
$DisplayName = $Template.displayName
104104
$TemplateJson = ConvertTo-Json -InputObject $Template -Depth 100 -Compress
105105
}
106+
'windowsQualityUpdatePolicies' {
107+
$Type = 'windowsQualityUpdatePolicies'
108+
$Template = New-GraphGetRequest -uri "https://graph.microsoft.com/beta/deviceManagement/$($urlname)/$($ID)" -tenantid $tenantfilter | Select-Object * -ExcludeProperty id, lastModifiedDateTime, '@odata.context', 'ScopeTagIds', 'supportsScopeTags', 'createdDateTime'
109+
$DisplayName = $Template.displayName
110+
$TemplateJson = ConvertTo-Json -InputObject $Template -Depth 100 -Compress
111+
}
112+
'windowsQualityUpdateProfiles' {
113+
$Type = 'windowsQualityUpdateProfiles'
114+
$Template = New-GraphGetRequest -uri "https://graph.microsoft.com/beta/deviceManagement/$($urlname)/$($ID)" -tenantid $tenantfilter | Select-Object * -ExcludeProperty id, lastModifiedDateTime, '@odata.context', 'ScopeTagIds', 'supportsScopeTags', 'createdDateTime'
115+
$DisplayName = $Template.displayName
116+
$TemplateJson = ConvertTo-Json -InputObject $Template -Depth 100 -Compress
117+
}
106118
}
107119
return [PSCustomObject]@{
108120
TemplateJson = $TemplateJson

Modules/CIPPCore/Public/New-CIPPTemplateRun.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ function New-CIPPTemplateRun {
9191
"https://graph.microsoft.com/beta/deviceAppManagement/mobileAppConfigurations?`$expand=assignments&`$filter=microsoft.graph.androidManagedStoreAppConfiguration/appSupportsOemConfig%20eq%20true"
9292
'https://graph.microsoft.com/beta/deviceManagement/configurationPolicies'
9393
'https://graph.microsoft.com/beta/deviceManagement/windowsFeatureUpdateProfiles'
94+
'https://graph.microsoft.com/beta/deviceManagement/windowsQualityUpdatePolicies'
95+
'https://graph.microsoft.com/beta/deviceManagement/windowsQualityUpdateProfiles'
9496
)
9597

9698
$Policies = foreach ($url in $GraphURLS) {

Modules/CIPPCore/Public/Set-CIPPIntunePolicy.ps1

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,46 @@ function Set-CIPPIntunePolicy {
175175
Write-LogMessage -headers $Headers -API $APINAME -tenant $($tenantFilter) -message "Added policy $($DisplayName) via template" -Sev 'info'
176176
}
177177
}
178-
178+
'windowsQualityUpdatePolicies' {
179+
$PlatformType = 'deviceManagement'
180+
$TemplateTypeURL = 'windowsQualityUpdatePolicies'
181+
$File = ($RawJSON | ConvertFrom-Json)
182+
$DisplayName = $File.displayName ?? $File.Name
183+
$CheckExististing = New-GraphGETRequest -uri "https://graph.microsoft.com/beta/$PlatformType/$TemplateTypeURL" -tenantid $tenantFilter
184+
if ($DisplayName -in $CheckExististing.displayName) {
185+
$PostType = 'edited'
186+
$PolicyFile = $RawJSON | ConvertFrom-Json | Select-Object *
187+
$RawJSON = ConvertTo-Json -InputObject $PolicyFile -Depth 100 -Compress
188+
$ExistingID = $CheckExististing | Where-Object -Property displayName -EQ $displayname
189+
Write-Host 'We are editing'
190+
$CreateRequest = New-GraphPOSTRequest -uri "https://graph.microsoft.com/beta/$PlatformType/$TemplateTypeURL/$($ExistingID.Id)" -tenantid $tenantFilter -type PATCH -body $RawJSON
191+
$CreateRequest = $CheckExististing | Where-Object -Property displayName -EQ $DisplayName
192+
} else {
193+
$PostType = 'added'
194+
$CreateRequest = New-GraphPOSTRequest -uri "https://graph.microsoft.com/beta/$PlatformType/$TemplateTypeURL" -tenantid $tenantFilter -type POST -body $RawJSON
195+
Write-LogMessage -headers $Headers -API $APINAME -tenant $($tenantFilter) -message "Added policy $($DisplayName) via template" -Sev 'info'
196+
}
197+
}
198+
'windowsQualityUpdateProfiles' {
199+
$PlatformType = 'deviceManagement'
200+
$TemplateTypeURL = 'windowsQualityUpdateProfiles'
201+
$File = ($RawJSON | ConvertFrom-Json)
202+
$DisplayName = $File.displayName ?? $File.Name
203+
$CheckExististing = New-GraphGETRequest -uri "https://graph.microsoft.com/beta/$PlatformType/$TemplateTypeURL" -tenantid $tenantFilter
204+
if ($DisplayName -in $CheckExististing.displayName) {
205+
$PostType = 'edited'
206+
$PolicyFile = $RawJSON | ConvertFrom-Json | Select-Object * -ExcludeProperty releaseDateDisplayName, deployableContentDisplayName
207+
$RawJSON = ConvertTo-Json -InputObject $PolicyFile -Depth 100 -Compress
208+
$ExistingID = $CheckExististing | Where-Object -Property displayName -EQ $displayname
209+
Write-Host 'We are editing'
210+
$CreateRequest = New-GraphPOSTRequest -uri "https://graph.microsoft.com/beta/$PlatformType/$TemplateTypeURL/$($ExistingID.Id)" -tenantid $tenantFilter -type PATCH -body $RawJSON
211+
$CreateRequest = $CheckExististing | Where-Object -Property displayName -EQ $DisplayName
212+
} else {
213+
$PostType = 'added'
214+
$CreateRequest = New-GraphPOSTRequest -uri "https://graph.microsoft.com/beta/$PlatformType/$TemplateTypeURL" -tenantid $tenantFilter -type POST -body $RawJSON
215+
Write-LogMessage -headers $Headers -API $APINAME -tenant $($tenantFilter) -message "Added policy $($DisplayName) via template" -Sev 'info'
216+
}
217+
}
179218
}
180219
Write-LogMessage -headers $Headers -API $APINAME -tenant $($tenantFilter) -message "$($PostType) policy $($Displayname)" -Sev 'Info'
181220
if ($AssignTo) {

0 commit comments

Comments
 (0)