File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,19 +19,19 @@ function Add-CIPPScheduledTask {
1919 $propertiesToCheck = @ (' Webhook' , ' Email' , ' PSA' )
2020 $PostExecution = ($propertiesToCheck | Where-Object { $task.PostExecution .$_ -eq $true }) -join ' ,'
2121 $Parameters = [System.Collections.Hashtable ]@ {}
22- foreach ($Key in $task.Parameters.Keys ) {
22+ foreach ($Key in $task.Parameters.PSObject.Properties.Name ) {
2323 $Param = $task.Parameters .$Key
24- if ($Param.Key ) {
24+ if ($Param -is [ System.Collections.IDictionary ] ) {
2525 $ht = @ {}
26- foreach ($p in $Param ) {
27- Write-Host $p.Key
26+ foreach ($p in $Param.GetEnumerator ()) {
2827 $ht [$p.Key ] = $p.Value
2928 }
3029 $Parameters [$Key ] = [PSCustomObject ]$ht
3130 } else {
3231 $Parameters [$Key ] = $Param
3332 }
3433 }
34+
3535 $Parameters = ($Parameters | ConvertTo-Json - Depth 10 - Compress)
3636 $AdditionalProperties = [System.Collections.Hashtable ]@ {}
3737 foreach ($Prop in $task.AdditionalProperties ) {
You can’t perform that action at this time.
0 commit comments