Convert curl script to Powershell

Associate
Joined
17 Nov 2006
Posts
123
Location
Manchester
Hi guys - I've got a curl script I'd like to create an equivalent PS script for Windows machines.

Code:
curl -b "dns_cookie=XXXXXXXXXX" -d "type=TXT" -d "subdomain=_acme-challenge" -d "domain_id=0000" -d "data_id=0000" -d "address=%22some_text%22" https://freedns.afraid.org/subdomain/save.php?step=2

I'm looking to do dns-01 challenges automatically by scripting the TXT record creation with my DNS provider.

Hopefully someone with better knowledge of PS can help.

Many thanks
 
Associate
OP
Joined
17 Nov 2006
Posts
123
Location
Manchester
Many thanks for the reply. I’ve installed curl - however when testing my script in it just seems to pull down the content of the Freedns page and my TXT record is not created.

Clearly there is something amiss in my syntax - I’ve inputted the dns_cookie correctly and my data_id is set correctly for the subdomain in question.

Here’s the FAQ on the freedns site for reference.

https://freedns.afraid.org/faq/#17

Any ideas?
 
Caporegime
Joined
18 Oct 2002
Posts
29,491
Location
Back in East London
Code:
Invoke-WebRequest -Method POST -Body @{ dns_cookie='XXXXXXXXXX'; type='TXT'; subdomain='_acme-challenge'; domain_id='0000'; address='%22some_text%22' } -Uri https://freedns.afraid.org/subdomain/save.php?step=2
 
Back
Top Bottom