How to find command in PowerShell? DNS Server Module
So, we are learning Windows PowerShell. Sometimes like me you have idea or need to do something hopefully in your lab not production and you want to try do it not with GUI.
Question is how do we find command? And how do we find a way to work with command?
In my lab I need to create DNS Record, first option is of course to open DNS Console and create but we are learning PowerShell. First let’s see if there is any module on my workstation which can be useful, I run Get-Module -ListAvailable *DNS*. We can see there is two modules one for client and one for server.
Now let’s run Get-Command -Module DNSServer to get list of commands we can work with. As I’m looking only for command to work with DNS records let’s narrow the search by adding -Name *Record*
We can see set of commands which look promissing Add-DNSServerResourceRecord. I want to add IPv4 record let’s use Add-DNSServerResourceRecordA command.
Just by running Add-DNSServerResourceRecordA pressing CTRL + Space we get a list of possible parameters to use.
Looking on parameters above I run command below. ComputerName we specify DNS Server, ZoneName and IP address. CreatePtr parameters is to create Reserve Lookup Zone entry. To retrive DNS server zone names we can use another command from DNSServer PowerShell module Get-DNSServerZone
Using Get-DNSServerResourceRecord we can confirm that both records has been created.
I hope this can help how to discover PowerShell capabilities to work with Windows Server components.