{"id":14980427,"url":"https://github.com/rmbolger/dnsclient-ps","last_synced_at":"2025-10-29T00:30:36.618Z","repository":{"id":148634663,"uuid":"264972105","full_name":"rmbolger/DnsClient-PS","owner":"rmbolger","description":"A cross-platform DNS client for PowerShell utilizing the DnsClient.NET library.","archived":false,"fork":false,"pushed_at":"2023-05-22T17:55:11.000Z","size":252,"stargazers_count":40,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-01T20:11:24.564Z","etag":null,"topics":["dig","dns","dns-client","dns-resolver","dnsclient","nslookup","powershell","powershell-core","powershell-module","resolver"],"latest_commit_sha":null,"homepage":"","language":"PowerShell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rmbolger.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-18T14:54:46.000Z","updated_at":"2025-01-19T16:28:04.000Z","dependencies_parsed_at":"2024-10-11T21:01:02.445Z","dependency_job_id":"a41475b7-b543-4d3d-81f5-368917613214","html_url":"https://github.com/rmbolger/DnsClient-PS","commit_stats":{"total_commits":26,"total_committers":2,"mean_commits":13.0,"dds":"0.15384615384615385","last_synced_commit":"0ec191e000c0f419a288181f65b3197f0596851e"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rmbolger%2FDnsClient-PS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rmbolger%2FDnsClient-PS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rmbolger%2FDnsClient-PS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rmbolger%2FDnsClient-PS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rmbolger","download_url":"https://codeload.github.com/rmbolger/DnsClient-PS/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238743900,"owners_count":19523197,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dig","dns","dns-client","dns-resolver","dnsclient","nslookup","powershell","powershell-core","powershell-module","resolver"],"created_at":"2024-09-24T14:01:45.801Z","updated_at":"2025-10-29T00:30:31.274Z","avatar_url":"https://github.com/rmbolger.png","language":"PowerShell","readme":"# DnsClient-PS\r\n\r\nA cross-platform DNS client for PowerShell utilizing the DnsClient.NET library.\r\n\r\nDNS query options in PowerShell and the native .NET class library have always been disappointing. [Resolve-DnsName](https://docs.microsoft.com/en-us/powershell/module/dnsclient/resolve-dnsname) is a decent addition, but it's only available on Windows and doesn't seem to be headed cross-platform anytime soon. The [System.Net.Dns](https://docs.microsoft.com/en-us/dotnet/api/system.net.dns) namespace is also extremely limited in its capabilities.\r\n\r\n[DnsClient.NET](https://dnsclient.michaco.net/) is a simple yet very powerful and high performant open source library for the .NET Framework to do DNS lookups. This module attempts to expose its power in a PowerShell native manner in order to automate DNS tasks without needing to parse the output of utilities like `nslookup` and `dig`. However, it is not intended to be a general replacement for those utilities.\r\n\r\n# Notable Features\r\n\r\n- Fully supported cross platform\r\n- Low level access to request/response protocol details\r\n- Optional dig'like human readable output\r\n- Optional response cache for performance sensitive tasks\r\n\r\n# Install\r\n\r\n## Release\r\n\r\nThe latest release version can found in the [PowerShell Gallery](https://www.powershellgallery.com/packages/DnsClient-PS/) or the [GitHub releases page](https://github.com/rmbolger/DnsClient-PS/releases). Installing from the gallery is easiest using `Install-Module` from the PowerShellGet module. See [Installing PowerShellGet](https://docs.microsoft.com/en-us/powershell/scripting/gallery/installing-psget) if you don't already have it installed.\r\n\r\n```powershell\r\n# install for all users (requires elevated privs)\r\nInstall-Module -Name DnsClient-PS -Scope AllUsers\r\n\r\n# install for current user\r\nInstall-Module -Name DnsClient-PS -Scope CurrentUser\r\n```\r\n\r\n*NOTE: If you use PowerShell 5.1 or earlier, `Install-Module` may throw an error depending on your Windows and .NET version due to a change PowerShell Gallery made to their TLS settings. For more info and a workaround, see the [official blog post](https://devblogs.microsoft.com/powershell/powershell-gallery-tls-support/).*\r\n\r\n\r\n## Development\r\n\r\nTo install the latest *development* version from the git main branch, use the following PowerShell command. This method assumes a default [`PSModulePath`](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_psmodulepath) environment variable.\r\n\r\n```powershell\r\n# install latest dev version\r\niex (irm https://raw.githubusercontent.com/rmbolger/DnsClient-PS/main/instdev.ps1)\r\n```\r\n\r\n# Quick Start\r\n\r\nThe primary function is `Resolve-Dns` and requires a `-Query` parameter that accepts one or more string values. This defaults to an A record lookup against your OS configured DNS server(s).\r\n\r\n```powershell\r\nResolve-Dns -Query google.com\r\n\r\nResolve-Dns google.com\r\n\r\nResolve-Dns 'google.com','www.google.com'\r\n\r\n'google.com','www.google.com' | Resolve-Dns\r\n```\r\n\r\nThe `-QueryType` and `-NameServer` parameters are the other two common ones you'll generally use. NameServer can take an array with IP addresses or FQDNs. Each one can also have an explicit port specified by appending `:\u003cport\u003e`.\r\n\r\n```powershell\r\n# Do an AAAA lookup\r\nResolve-Dns google.com -QueryType AAAA\r\n\r\nResolve-Dns google.com AAAA\r\n\r\n# Do an SRV lookup against a domain controller\r\nResolve-Dns _gc._tcp.contoso.com SRV -NameServer dc1.contoso.com\r\n\r\nResolve-Dns _gc._tcp.contoso.com SRV -ns dc1.contoso.com,dc2.contoso.com\r\n\r\nResolve-Dns _gc._tcp.contoso.com SRV -ns 192.168.0.1:53,dc2.contoso.com:53\r\n```\r\n\r\nThe output of a successful query is a [DnsQueryResponse](https://dnsclient.michaco.net/docs/DnsClient.DnsQueryResponse.html) object. Its raw form isn't very human readable, but it's quite comprehensive in the detail it provides about the response. If all you care about are the answers, you will want to do something like this.\r\n\r\n```powershell\r\nResolve-Dns google.com | Select-Object -Expand Answers\r\n\r\n(Resolve-Dns google.com).Answers\r\n```\r\n\r\nKeep in mind that answers for different record types are also different object types with different properties. For example, notice the differences between the following:\r\n\r\n```powershell\r\nResolve-Dns google.com a | Select-Object -Expand Answers | Get-Member\r\nResolve-Dns google.com txt | Select-Object -Expand Answers | Get-Member\r\nResolve-Dns google.com soa | Select-Object -Expand Answers | Get-Member\r\n```\r\n\r\nThere are a number of optional parameters that can alter various settings for a query such as `-Recursion`, `-Timeout`, and `-UseTcpOnly`. These can be set on a per-call basis using the parameters available in `Resolve-Dns` or they can be set as new defaults for the current session using `Set-DnsClientSetting`.\r\n\r\n```powershell\r\n# Disable recursion and change the timeout for this call only\r\nResolve-Dns google.com -ns ns1.google.com -Recursion:$false -Timeout (New-Timespan -Sec 30)\r\n\r\n# Change the settings for all queries in this session\r\nSet-DnsClientSettings -ns ns1.google.com -Recursion:$false -Timeout (New-Timespan -Sec 30)\r\nResolve-Dns google.com\r\n\r\n# Check the current session settings\r\nGet-DnsClientSettings\r\n```\r\n\r\n# Requirements and Platform Support\r\n\r\n* Supports Windows PowerShell 5.1 or later (Desktop edition) **with .NET Framework 4.7.1** or later.\r\n* Supports [PowerShell](https://docs.microsoft.com/en-us/powershell/scripting/whats-new/what-s-new-in-powershell-70) 7.0 or later (Core edition) on all supported OS platforms.\r\n* PowerShell 6.x should also work, but I won't be actively testing against it.\r\n\r\n# Changelog\r\n\r\nSee [CHANGELOG.md](/CHANGELOG.md)\r\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frmbolger%2Fdnsclient-ps","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frmbolger%2Fdnsclient-ps","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frmbolger%2Fdnsclient-ps/lists"}