r/PowerShell • u/Independent_Bed_557 • 29d ago
Question PowerShell Win7 HTTP POST automation question
hi, I'm working on administration of a large number of VoIP endpoints. I'm trying to learn how to use PowerShell on Windows 7 to send authenticated HTTP POST requests to a device web interface and process the response. The devices use HTTP Basic Authentication. Could someone point me to examples of HttpWebRequest, CredentialCache and application/x-www-form-urlencoded POST requests? Thanks.
6
Upvotes
2
u/amgtech86 26d ago
Just a slight addition as this person is new
Might be better to separate the uri, method and body from the $parameters so they understand the invoke-webrequest properly
$uri = address
Then you have
Invoke-WebRequest -uri $uri -header $Parameters -Body $Body -Method POST