Invoke-RestMethod Body variable

8 views
Skip to first unread message

glenn.r...@rsipvm.com

unread,
May 10, 2018, 8:27:39 PM5/10/18
to
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
Reply all
Reply to author
Forward
0 new messages