r/PowerShell • u/Independent_Bed_557 • Oct 07 '26
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
14
u/krzydoug Oct 08 '26
Windows 7 and http basic auth, 2010 called and want their stuff back.
10
u/BlackV Oct 08 '26 edited Oct 08 '26
can you confirm you meant Windows 7 or did you mean Powershell 7
what have you tried so far?
2
u/Villainsympatico Oct 09 '26
If you're using invoke-webrequest or invoke-restmethod, you can pass the credentials to a credential object with get-credential, then it should be
$form = @{#whatever you are posting goes here}invoke-webrequest -credential $cred -method post -form $forminvoke webrequest returns the entire response , (body, headers, response codes), while invoke-restmethod only returns the body.
If its for voip endpoints though, wouldn't you be managing through the server side? why reach out to the endpoints?
1
u/Agile_Seer Oct 09 '26
If you are actually using the Windows 7 operating system and you want to use PowerShell, download & install the Windows Management Framework 5.1. This will get you Windows PowerShell 5.1. I believe Windows 7 ships with PowerShell 2.0.
You can also install PowerShell 7 on Windows 7, but I still recommend installing WMF to get the Windows PowerShell upgraded to 5.1.