Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New-IntuneDeviceConfigurationPolicy parameter 'payload' takes System.Byte[] - fails trying conversion to System.Object[] #47

Open
fallmake opened this issue Jun 5, 2019 · 0 comments

Comments

@fallmake
Copy link

fallmake commented Jun 5, 2019

I want to create an iosCustomConfiguration in version 6.1902.1.10 by doing the following. The "payload" parameter of New-IntuneDeviceConfigurationPolicy expects System.Byte[], but proceeds to try to convert this into System.Object[] which fails.

Am I doing something wrong?

$encoding = [System.Text.UTF8Encoding]::new()
$configXmlPayload = $encoding.GetBytes($configXml.OuterXml)
$configXmlPayload.GetType()

New-IntuneDeviceConfigurationPolicy `
    -ODataType "#microsoft.graph.iosCustomConfiguration" `
    -displayName "Test" `
    -description "Some text" `
    -payloadName "Test_Payload" `
    -payloadFileName "testpayload.xml" `
    -payload $configXmlPayload

This results in:

IsPublic IsSerial Name                                     BaseType                                                                                                                                     
-------- -------- ----                                     --------                                                                                                                                     
True     True     Byte[]                                   System.Array                                                                                                                                 


Message        : Unable to cast object of type 'System.Byte[]' to type 'System.Object[]'.
Data           : {}
InnerException : 
TargetSite     : System.String ToODataString(System.Object, System.String, Boolean, Boolean)
StackTrace     :    at Microsoft.Intune.PowerShellGraphSDK.ODataTypeUtils.ToODataString(Object value, String oDataTypeFullName, Boolean isArray, Boolean isUrlValue)
                    at Microsoft.Intune.PowerShellGraphSDK.PowerShellCmdlets.ODataCmdletBase.WriteJsonFromProperties(IEnumerable`1 properties, String oDataType)
                    at Microsoft.Intune.PowerShellGraphSDK.PowerShellCmdlets.ODataCmdletBase.Run()
                    at System.Management.Automation.CommandProcessor.ProcessRecord()
HelpLink       : 
Source         : Microsoft.Intune.PowerShellGraphSDK
HResult        : -2147467262
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant