Use Custom Script Help

Does anybody have examples of the custom scripts? I’m having a hard time figuring out how does this program communicate with the DNS service API… If anybody has a .bat script they’re willing to share I would love to see it.

Thanks, Taylor

1 Like

Which DNS provider are you trying to talk to?

Note that the latest beta (4.1.0-beta2) has support for acme-dns CNAME redirection (e.g. no DNS API required) and beta support for Microsoft DNS.

1 Like

https://www.dynu.com/

1 Like

Okay, now I have a better understanding of how the .bat file works.
But are there any examples of the .ps1 file?
As you can tell I’m very new to scripting…

1 Like

https://www.powershellgallery.com/packages/Posh-ACME/2.7.0/Content/DnsPlugins\Dynu.ps1

I can’t speak to the validity of it, but this appears to be what you are looking for more or less. The API for your provider is based on making web requests.

Add-DnsTxtDynu would let you add records in the add script. Remove-DnsTxtDynu will let you remove them after. You will need an API key from Dynu to make use of it.

Thank you for that URL it is helping me build this Powershell script.

However I am having trouble getting the API key authentication working.

This is what I have so far.

Invoke-RestMethod -Method GET -Uri ‘https://api.dynu.com/v2/DNS’ -ContentType ‘application/json’ -Headers @{ “X-Api-Key” = ‘The API key goes here’}

I still receive a 401 authentication error.

Does your script actually say “The API key goes here” or did you put your API key there? You need to get an API key from dynu and replace ‘The API key goes here’ with that key.

No I went on to Dynu found the API key and plug it in. I didn’t want to publicly show my API key.

According to their docs the auth header is ‘API-Key’ (without the ‘X-’): https://www.dynu.com/Support/API

That worked!!
Thanks!!

1 Like

batch files are old and outdated; learn and use PowerShell where possible.

You have to use a batch script(s) to execute the PowerShell script(s) for CTW.