I have tried so many things suggested in many discussions across SO and other sites to no avail. Here is my command that I am trying to capture full output of in a variable.
Invoke-WebRequest -Method Post -Uri http://www.google.com
Here is how I tried doing it (one of the many ways)
$output1 = & Invoke-WebRequest -Method Post -Uri http://www.google.com 2>&1
It continues to show the stderr output in the console and captures nothing in the variable. I have also tried Out-String and Tee-Object
What am I doing wrong?