<p>VMware ESX, ESXi, and VirtualCenter are supposed to be able to support HTTP PUT uploads since version 3.5. I know how to do downloads, that's easy. I've never done PUT before.</p>

<p>Background information on the topic is here: <a href="http://communities.vmware.com/thread/117504" rel="nofollow noreferrer">http://communities.vmware.com/thread/117504</a></p>

[{'answer_id': 67048, 'author': 'Jaykul', 'author_id': 8718, 'author_profile': 'https://Stackoverflow.com/users/8718', 'pm_score': 2, 'selected': False, 'text': '<p>You should have a look at the <code>Send-PoshCode</code> function in the <a href="http://PoshCode.org/" rel="nofollow noreferrer">PoshCode</a> cmdlets script module ... it uses a POST, not a PUT, but the technique is practically identical.  I don\'t have PUT server I can think of to test against, but basically, set your $url and your $data, and do something like:</p>\n\n<pre><code>param($url,$data,$filename,[switch]$quiet)\n\n$request = [System.Net.WebRequest]::Create($url)\n$data = [Text.Encoding]::UTF8.GetBytes( $data )\n\n## Be careful to set your content type appropriately...\n## This is what you\'re going to SEND THEM\n$request.ContentType = \'text/xml;charset="utf-8"\' # "application/json"; # "application/x-www-form-urlencoded"; \n## This is what you expect back\n$request.Accept = "text/xml" # "application/json";\n\n$request.ContentLength = $data.Length\n$request.Method = "PUT"\n## If you need Credentials ...\n# $request.Credentials = (Get-Credential).GetNetworkCredential()\n\n$put = new-object IO.StreamWriter $request.GetRequestStream()\n$put.Write($data,0,$data.Length)\n$put.Flush()\n$put.Close()\n\n## This is the "simple" way ...\n# $reader = new-object IO.StreamReader $request.GetResponse().GetResponseStream() ##,[Text.Encoding]::UTF8\n# write-output $reader.ReadToEnd()\n# $reader.Close()\n\n## But there\'s code in PoshCode.psm1 for doing a progress bar, something like ....\n\n$res = $request.GetResponse();\nif($res.StatusCode -eq 200) {\n   [int]$goal = $res.ContentLength\n   $reader = $res.GetResponseStream()\n   if($fileName) {\n      $writer = new-object System.IO.FileStream $fileName, "Create"\n   }\n\n   [byte[]]$buffer = new-object byte[] 4096\n   [int]$total = [int]$count = 0\n   do\n   {\n      $count = $reader.Read($buffer, 0, $buffer.Length);\n      if($fileName) {\n         $writer.Write($buffer, 0, $count);\n      } else {\n         $output += $encoding.GetString($buffer,0,$count)\n      }\n      if(!$quiet) {\n         $total += $count\n         if($goal -gt 0) {\n            Write-Progress "Downloading $url" "Saving $total of $goal" -id 0 -percentComplete (($total/$goal)*100)\n         } else {\n            Write-Progress "Downloading $url" "Saving $total bytes..." -id 0\n         }\n      }\n   } while ($count -gt 0)\n\n   $reader.Close()\n   if($fileName) {\n       $writer.Flush()\n       $writer.Close()\n   } else {\n       $output\n   }\n}\n$res.Close();\n</code></pre>\n'}, {'answer_id': 1094142, 'author': 'user134454', 'author_id': 134454, 'author_profile': 'https://Stackoverflow.com/users/134454', 'pm_score': 3, 'selected': True, 'text': '<p>In the <a href="http://www.codeplex.com/vitoolkitextensions" rel="nofollow noreferrer">VI Toolkit Extensions</a> use Copy-TkeDatastoreFile. It will work with binaries.</p>\n'}]
['https://Stackoverflow.com/questions/65856', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/6637/']