[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Invoke-WebRequest : This operation is not supported for a relative URI.

Posted on 2014-02-26
1
Medium Priority
?
3,131 Views
Last Modified: 2014-02-26
With a lot of help from experts the following code is working fine:-
$postParams = "username=me&moredata=qwerty66"
$test = Invoke-WebRequest -Uri http://localhost/TestForm.php -Method POST -Body $postParams -Proxy '172.16.8.11:3128'

write-host $test

Open in new window


However if I put an external domain in:-
$postParams = "username=me&moredata=qwerty66"
$test = Invoke-WebRequest -Uri http://test.tonycross.me.uk/testForm.php -Method POST -Body $postParams -Proxy '172.16.8.11:3128'

write-host $test

Open in new window


I get:-

Invoke-WebRequest : This operation is not supported for a relative URI.
At D:\Users\TCross\Desktop\Post Data - Invoke.ps1:5 char:9
+ $test = Invoke-WebRequest -Uri "http://test.tonycross.me.uk/testForm.php" -Metho ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Invoke-WebRequest], InvalidOperationException
    + FullyQualifiedErrorId : System.InvalidOperationException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

What its supposed to do is just post some data to a webform and get a response from the server.

Any ideas what Im doing wrong?

Thank you
0
Comment
Question by:tonelm54
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 41

Accepted Solution

by:
footech earned 2000 total points
ID: 39890006
This really isn't a command I've used before so the help I can provide is probably limited, but since no one else had replied yet...

The command worked for me if I removed the -proxy parameter.  So I'm thinking the problem must be there.
0

Featured Post

Looking for the Wi-Fi vendor that's right for you?

We know how difficult it can be to evaluate Wi-Fi vendors, so we created this helpful Wi-Fi Buyer's Guide to help you find the Wi-Fi vendor that's right for your business! Download the guide and get started on our checklist today!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This script can help you clean up your user profile database by comparing profiles to Active Directory users in a particular OU, and removing the profiles that don't match.
A project that enables an administrator to perform actions within a user session context not just at the time of login but any time later on day(s) or week(s) later.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question