Asked by:
timeout for resolve-dnsname too long (over 4 sec)

Question
-
How can I make resolve-dns timeout faster?
Even if I run a job, stop-job or remove-job takes over 4 seconds.
PS C:\> measure-command { resolve-dnsname -QuickTimeout 1.1.1.1 } resolve-dnsname : 1.1.1.1.in-addr.arpa : DNS name does not exist At line:1 char:19 + measure-command { resolve-dnsname -QuickTimeout 1.1.1.1 } + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ResourceUnavailable: (1.1.1.1.in-addr.arpa:String) [Resolve-DnsName], Win32Exception + FullyQualifiedErrorId : DNS_ERROR_RCODE_NAME_ERROR,Microsoft.DnsClient.Commands.ResolveDnsName Days : 0 Hours : 0 Minutes : 0 Seconds : 4 Milliseconds : 634 Ticks : 46345940 TotalDays : 5.36411342592593E-05 TotalHours : 0.00128738722222222 TotalMinutes : 0.0772432333333333 TotalSeconds : 4.634594 TotalMilliseconds : 4634.594
- Edited by JS2010 Thursday, August 24, 2017 2:33 PM
Thursday, August 24, 2017 2:32 PM
All replies
-
I would try and fix the issue.
I can timeout a name in a few mils (~50ms).
You can also add -NoRecursion but a properly set up network and DNS should never take that long.
This is not a scripting issue. You will need to repair the cause.
\_(ツ)_/
Thursday, August 24, 2017 5:31 PM -
With 1.1.1.1 you don't have that problem? -NoRecursion gave me the same result.
- Edited by JS2010 Thursday, August 24, 2017 5:58 PM
Thursday, August 24, 2017 5:57 PM -
45 ms to 1.1.1.1 error "1.1.1.1.in-addr.arpa : DNS name does not exist"
The issue is with your DNS servers.
if dns defines that reverse lookup then you can have issues with resolution. The DNS servers are the issue and not PowerShell.
\_(ツ)_/
Thursday, August 24, 2017 6:22 PM -
-DnsOnly fixes it
Thursday, August 24, 2017 6:35 PM -
That indicates that you have a likely system issue. Start by rebooting you PC. If you have a virtual switch configured this can cause issues like this.
\_(ツ)_/
Thursday, August 24, 2017 6:39 PM