Uso de PowerShell Invoke-RestMethod para PUBLICAR grandes datos binarios multiparte / formulario

Estoy tratando de usar elInvoke-RestMethod cmdlet en PowerShell 3 y 4, para cargar un archivo binario grande mediante la carga de datos / formularios multiparte de una API REST. Aquí hay un ejemplo de cURL que funciona sobre cómo realizar lo que quiero hacer en PowerShell:

curl -i -k -H "accept: application/json" -H "content-type: multipart/form-data" -H "accept-language: en-us" -H "auth: tokenid" -F file="@Z:\large_binary_file.bin" -X POST "https://server/rest/uri2"

Me encantaría ver un ejemplo de trabajo sobre cómo usar Invoke-RestMethod para PUBLICAR un multiparte / datos de formulario. Encontre unpublicación de blog del equipo de PowerShell que muestra cómo usar Invoke-RestMethod cargar a OneDrive (también conocido como SkyDrive), pero no funciona bien. También me gustaría evitar usar System.Net.WebClient si es posible. Yo tambien encontreotro hilo aquí en Stackoverflow, pero realmente no ayudó mucho.

[System.Net.ServicePointManager]::ServerCertificateValidationCallback = { $true }

$server = "https://server"
uri = "/rest/uri1"
$headers = @{"accept" = "application/json"; "content-type" = "application/json";"accept-language" = "en-us"}
$body = @{"userName" = "administrator"; "password" = "password"}
$method = "POST"

#Get Session ID
$resp = Invoke-RestMethod -Method $method -Headers $headers -Uri ($server+$uri) -body (convertto-json $Body -depth 99)

$sessionID = $resp.sessionID

#Upload file
$uri = "/rest/uri2"
$headers = @{"accept" = "application/json";"content-type" = "multipart/form-data"; "accept-        language" = "en-us"; "auth" = $sessionID}
$medthod = "POST"
$largeFile = "Z:\large_binary_file.bin"

He intentado ambas formas de usar Invoke-RestMethod:

Invoke-RestMethod -Method $method -Headers $headers -Uri ($server+$uri) -InFile $largeFile

o

$body = "file=$(get-content $updateFile -Enc Byte -raw)"
Invoke-RestMethod -Method $method -Headers $headers -Uri ($server+$uri) -body $body

Respuestas a la pregunta(1)

Su respuesta a la pregunta