rmbolger / dnsclient-ps Goto Github PK
View Code? Open in Web Editor NEWA cross-platform DNS client for PowerShell utilizing the DnsClient.NET library.
License: MIT License
A cross-platform DNS client for PowerShell utilizing the DnsClient.NET library.
License: MIT License
$(Resolve-Dns -NameServer $dnsServer -Query $FQDNsToQueryFor | Select-Object -Expand Answers)
DomainName TimeToLive RecordClass RecordType RecordData
---------- ---------- ----------- ---------- ----------
api.monitor.azure.com. 192 IN CNAME api.privatelink.monitor.azure.com.
api.privatelink.monitor.azure.com. 9 IN A SCRUBBED
However when trying to reference the 'RecordData' property/column I get a null value
$(Resolve-Dns -NameServer $dnsServer -Query $FQDNsToQueryFor | Select-Object -Expand Answers).RecordData
I wanted to do some further digging and tried the following command:
$((Resolve-Dns -NameServer $dnsServer -Query $FQDNsToQueryFor | Select-Object -Expand Answers) | Select-Object -Property *)
CanonicalName : api.privatelink.monitor.azure.com.
DomainName : api.monitor.azure.com.
RecordType : CNAME
RecordClass : IN
TimeToLive : 63
InitialTimeToLive : 63
RawDataLength : 18
Address : SCRUBBED
DomainName : api.privatelink.monitor.azure.com.
RecordType : A
RecordClass : IN
TimeToLive : 0
InitialTimeToLive : 0
RawDataLength : 4
So then I tried to reference the 'Address' Property of the Object in the Array, but got a weird Result...
$((Resolve-Dns -NameServer $dnsServer -Query $FQDNsToQueryFor | Select-Object -Expand Answers) | Select-Object -Property *).Address
OverloadDefinitions
-------------------
System.Object&, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e Address(int )
I did a little digging and found that the property Name for 'Address' might cause some problems, it doesn't seem to be a Reserved word, but the Address METHOD seems to supersede calling the property? I don't know if I am using proper terminology as I am newer to C# and PowerShell scripting, but you may be able to understand.
Here is the relevant PowerShell issue that is actually still open.
PowerShell/PowerShell#8105
As the tile said, the module throw a powershell error and not a "inexistent domain" with an inexistent domain.
Ex:
⮞ resolve-dns xttox.com`
MethodInvocationException: C:\Users\exp1x835\OneDrive - Beneva\Documents\PowerShell\Modules\DnsClient-PS\1.1.1\Public\Resolve-Dns.ps1:78`
Line |
78 | $client.QueryServer($nsList, $qst)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Exception calling "QueryServer" with "2" argument(s): "Query 42931 => xttox.com IN A on
| 96.45.46.46:53 timed out or is a transient error."
When I tested the module, it works in PowerShell 7 but fails in Windows PowerShell.
With any cmdlet, I get this exception:
Exception calling "QueryServer" with "2" argument(s): "Query 59746 =>
8.8.8.8.in-addr.arpa. IN PTR on 192.168.2.1:53 failed with an error."
At C:\Users\tobia\OneDrive\Dokumente\WindowsPowerShell\Modules\DnsClient-
PS\1.1.0\Public\Resolve-Dns.ps1:78 char:17
+ $client.QueryServer($nsList, $qst)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationExce
ption
+ FullyQualifiedErrorId : DnsResponseException
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.