• Invoke-RestMethod Body variable

    From glenn.robinson@rsipvm.com@21:1/5 to All on Thu May 10 17:27:38 2018
    I'm having trouble using the Invoke-RestMethod and the -Body value.

    I need to get all of the following in to a variable which I'll pass to the -Body parameter:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <LogonRequest xmlns="http://www.ibm.com/xmlns/systems/power/firmware/web/mc/2012_10/" schemaVersion="V1_0">
    <UserID>user1</UserID>
    <Password>12345678</Password>
    </LogonRequest>

    If I create a hash then I can use:

    UserId=user1
    Password=12345678

    and I can generate the key and value pairs using ConvertFrom-StringData.

    But, what I need is to have all of the text above, not just UserID and Password. The -Body parameter expects and object:

    [-Body <Object>]


    Any ideas on how I achieve this?

    Thanks

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)