This is a part of an on-going blog series written by Adam Gordon. Each week, Adam will walk you through a PowerShell command, showing you when and how to use each one. This week, Adam covers Get-DnsServer.
When to use Get-DnsServer?
The Get-DnsServer cmdlet retrieves a Domain Name System (DNS) server configuration. The DNS server must be running Windows Server 2008 R2 operating system or above.
You can pass the output of the Get-DnsServer cmdlet to the Export-Clixml cmdlet by using the pipeline operator. That cmdlet generates an XML file of the configuration. You can use the XML file to back up or transfer DNS settings between computers.
What version of PowerShell am I using for this blog?
Get the PowerShell Version from your machine:
This command shows you the PowerShell version information on your machine.
How to use Get-DnsServer?
Get a DNS server configuration:
Get-DnsServer -ComputerName “10.0.0.2”
This command gets a DNS server configuration.
Get local DNS server configuration and then export it:
Get-DnsServer | Export-Clixml -Path “c:\config\DnsServerConfig.xml”
This command gets the DNS server configuration on the local server and passes it to the Export-Clixml cmdlet to be translated into an XML file.
Learn last week’s command: Get-GPOReport.
Need PowerShell training? Check out ITProTV’s PowerShell online IT training courses.