This repository of PowerShell sample scripts show how to access Intune service resources. They demonstrate this by making HTTPS RESTful API requests to the Microsoft Graph API from PowerShell.
Integrating Application_iOS_Add.ps1 into some automation scripts, I kept getting errors from the JSON being generated.
I ended up making a few changes in order to get it to generate a correct payload:
Changed:
$iconType = $iconResponse.Headers["Content-Type"]
to
$iconType = $iconResponse.Headers["Content-Type"][0]
and the logic for setting minimum version did not work , so the min version was always false for every item. Updated as follows:
minimumSupportedOperatingSystem=@{
"@odata.type" = "microsoft.graph.iosMinimumOperatingSystem"
v8_0=$osVersion -lt 9.0;
v9_0=$osVersion.ToString().StartsWith("9")
v10_0=$osVersion.ToString().StartsWith("10")
v11_0=$osVersion.ToString().StartsWith("11")
v12_0=$osVersion.ToString().StartsWith("12")
v13_0=$osVersion.ToString().StartsWith("13")
v14_0=$osVersion.ToString().StartsWith("14")
v15_0=$osVersion.ToString().StartsWith("15")
v16_0=$osVersion.ToString().StartsWith("16")
};
After making these changes, the payloads worked as expected.
Integrating Application_iOS_Add.ps1 into some automation scripts, I kept getting errors from the JSON being generated. I ended up making a few changes in order to get it to generate a correct payload: Changed: $iconType = $iconResponse.Headers["Content-Type"] to $iconType = $iconResponse.Headers["Content-Type"][0]
and the logic for setting minimum version did not work , so the min version was always false for every item. Updated as follows: minimumSupportedOperatingSystem=@{ "@odata.type" = "microsoft.graph.iosMinimumOperatingSystem"
v8_0=$osVersion -lt 9.0; v9_0=$osVersion.ToString().StartsWith("9") v10_0=$osVersion.ToString().StartsWith("10") v11_0=$osVersion.ToString().StartsWith("11") v12_0=$osVersion.ToString().StartsWith("12") v13_0=$osVersion.ToString().StartsWith("13") v14_0=$osVersion.ToString().StartsWith("14") v15_0=$osVersion.ToString().StartsWith("15") v16_0=$osVersion.ToString().StartsWith("16")
};
After making these changes, the payloads worked as expected.