In Linux, I would use dig
to specify a DNS server of 127.0.0.1 with the following command:
dig google.com @127.0.0.1
I installed Bind tools for windows (choco install bind-toolsonly
). How can I run that same command? I get the following error:
PS C:\Users\jhilden> dig google.com @127.0.0.1 At line:1 char:21 + dig google.com @127.0.0.1 + ~ Missing property name after reference operator. At line:1 char:16 + dig google.com @127.0.0.1 + ~~~~ The splatting operator '@' cannot be used to reference variables in an expression. '@127' can be used only as an argument to a command. To reference variables in an expression use '$127'. + CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException + FullyQualifiedErrorId : MissingPropertyName
I know this answer doesn't use Bind tools, as you inferred in your question. That said, however, PowerShell comes with the Resolve-DnsName
to perform this task. I believe that the following command will do what you are after
Resolve-DnsName -Name google.com -Server 127.0.0.1