JoeRod
JoeRod

Reputation: 921

IP wildcards in script

I wrote a script to query DNS for IP address and host-names, this works great but I'd like to further prune my data and only show results of IP address 10.9.x.x, does anyone know a good way to do this?

get-wmiobject -ComputerName DNSServer -Namespace root\microsoftDNS -Class MicrosoftDNS_ResourceRecord -Filter "domainname='contoso.local'"| select ipaddress, ownername |sort ownername

Upvotes: 0

Views: 780

Answers (1)

Ansgar Wiechers
Ansgar Wiechers

Reputation: 200563

Filter the result using the Where-Object cmdlet (alias ?):

... | select ipaddress, ownername | ? { $_.ipaddress -like '10.9.*' } |
  sort ownername

Upvotes: 1

Related Questions