Skip to content

Powershell TimeToLive parameter format inconsistency in DNS cmdlet doco vs examples #3282

Open
@dbgitrdone

Description

@dbgitrdone

There seems to be a disconnect regarding the Add-DnsServerResourceRecordA (and others) cmdlet format for the -TimeToLive value. All examples I see show a ??:??:?? (Hours:Minutes:Seconds ?) format yet this doesn't agree with the doco which states it is a seconds value.

Doesn't matter which product / version I reference - it is all consistent in the inconsistency.

So which is it?


From the doco:

-TimeToLive
Specifies the Time to Live (TTL) value, in seconds, for a resource record.


From the examples (Everywhere it seems):

Example 1: Add a DNS record
PowerShell
PS C:> Add-DnsServerResourceRecordA -Name "host23" -ZoneName "contoso.com" -AllowUpdateAny -IPv4Address "172.18.99.23" -TimeToLive 01:00:00


Error when using ??:??:?? format:

I tried the ??:??:?? format but that doesn't work. Only an integer seconds value seems to work for me.

Error:

Add-DnsServerResourceRecordA : Cannot process argument transformation on parameter 'TimeToLive'. Cannot convert value
"01:00:00Add-DnsServerResourceRecordA" to type "System.TimeSpan". Error: "String was not recognized as a valid TimeSpan."


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

Metadata

Metadata

Assignees

Labels

area-dnsserverIssues for dnsserver moduledoc-bugFor Upwork freelance team categories/reporting.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions