-
Notifications
You must be signed in to change notification settings - Fork 5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/dev' into dev
- Loading branch information
Showing
2 changed files
with
6 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,10 +35,10 @@ function Set-CIPPIntunePolicy { | |
$JSON = $RawJSON | ConvertFrom-Json | Select-Object * -ExcludeProperty id, createdDateTime, lastModifiedDateTime, version, '[email protected]', '@odata.context' | ||
$JSON.scheduledActionsForRule = @($JSON.scheduledActionsForRule | Select-Object * -ExcludeProperty '[email protected]') | ||
if ($displayname -in $CheckExististing.displayName) { | ||
$RawJSON = ConvertTo-Json -InputObject ($JSON | Select-Object * -ExcludeProperty 'scheduledActionsForRule') -Depth 20 -Compress | ||
$RawJSON = ConvertTo-Json -InputObject $JSON -Depth 20 -Compress | ||
$PostType = 'edited' | ||
$ExistingID = $CheckExististing | Where-Object -Property displayName -EQ $displayname | ||
$CreateRequest = New-GraphPOSTRequest -uri "https://graph.microsoft.com/beta/deviceManagement/$TemplateTypeURL/$($ExistingID.Id)" -tenantid $tenantFilter -type PATCH -body $RawJSON | ||
$CreateRequest = New-GraphPOSTRequest -uri "https://graph.microsoft.com/beta/deviceManagement/$TemplateTypeURL/$($ExistingID.Id)" -tenantid $tenantFilter -type PUT -body $RawJSON | ||
Write-LogMessage -user $request.headers.'x-ms-client-principal' -API $APINAME -tenant $($tenantFilter) -message "Updated policy $($DisplayName) to template defaults" -Sev 'info' | ||
$CreateRequest = $CheckExististing | Where-Object -Property displayName -EQ $DisplayName | ||
} else { | ||
|
@@ -75,13 +75,15 @@ function Set-CIPPIntunePolicy { | |
'Device' { | ||
$TemplateTypeURL = 'deviceConfigurations' | ||
$PolicyFile = $RawJSON | ConvertFrom-Json | ||
$Null = $PolicyFile | Add-Member -MemberType NoteProperty -Name 'description' -Value $description -Force | ||
$Null = $PolicyFile | Add-Member -MemberType NoteProperty -Name 'description' -Value "$description" -Force | ||
$null = $PolicyFile | Add-Member -MemberType NoteProperty -Name 'displayName' -Value $displayname -Force | ||
$RawJSON = ConvertTo-Json -InputObject $PolicyFile -Depth 20 | ||
$CheckExististing = New-GraphGETRequest -uri "https://graph.microsoft.com/beta/deviceManagement/$TemplateTypeURL" -tenantid $tenantFilter | ||
if ($PolicyFile.displayName -in $CheckExististing.displayName) { | ||
$PostType = 'edited' | ||
Write-Host 'hit' | ||
$ExistingID = $CheckExististing | Where-Object -Property displayName -EQ $DisplayName | ||
Write-Host "https://graph.microsoft.com/beta/deviceManagement/$TemplateTypeURL/$($ExistingID.Id)" | ||
$CreateRequest = New-GraphPOSTRequest -uri "https://graph.microsoft.com/beta/deviceManagement/$TemplateTypeURL/$($ExistingID.Id)" -tenantid $tenantFilter -type PATCH -body $RawJSON | ||
$CreateRequest = $CheckExististing | Where-Object -Property displayName -EQ $DisplayName | ||
Write-LogMessage -user $request.headers.'x-ms-client-principal' -API $APINAME -tenant $($tenantFilter) -message "Updated policy $($DisplayName) to template defaults" -Sev 'info' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters