Description
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.
- ID: ed1c131a-c937-8ed6-573e-6584058f4b2a
- Version Independent ID: 581d4e37-b526-d0d6-50e5-611bf12dec4c
- Content: Add-DnsServerResourceRecordA (DnsServer)
- Content Source: docset/winserver2019-ps/dnsserver/Add-DnsServerResourceRecordA.md
- Product: w10
- Technology: windows
- GitHub Login: @JasonGerend
- Microsoft Alias: jgerend