Invoke-webrequest doesn't comeout when posting data on server with -InFile flag

I am using invoke-webrequest command to load a file on server with POST command, and the file does get loaded. However the command hangs in console until I hit enter.

Here's what I m executing: 

Invoke-RestMethod -Uri $url -Method POST -ContentType $ContentType -Headers $headerHash -InFile $filePath  -TimeoutSec $timeOut

I am running powershell 3.0 on win2k12.

I ran the command with Verbose on, and it ask for confirmation to run the command as below. However when I provided -confirm:$true, invoke-webrequest suggests that there's no confirm command. I am not sure how to proceed.

Confirm
Continue with this operation?
[Y] Yes  [A] Yes to All  [H] Halt Command  [S] Suspend  [?] Help (default is "Y"):

  • Edited by Varun Vyas Wednesday, February 25, 2015 1:43 PM
February 24th, 2015 6:55pm

Hi Varun Vyas,

Based on your description, this issue is more related to PowerShell. I suggest that you should post the question in Windows PowerShell forum. I believe we will get a better assistance there.

For Invoke-WebRequest cmdlet, please refer to following article and check if can help you.

Invoke-WebRequest

Best regards,

Justin Gu

Free Windows Admin Tool Kit Click here and download it now
February 26th, 2015 7:46am

Hi Varun Vyas,

Would you please let me know current situation of this issue? Just check if you post the question in PowerShell forum and then solve this issue. If any update, please feel free to let me know.

Best regards,

Justin Gu

March 9th, 2015 3:17am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics