c# - WMI Query DNS CNAME in subdomains -
i trying write following powershell script in c# using wmi queries.
get-dnsserverzone -computername [dns server] | ? {$_.zonename} | get-dnsserverresourcerecord -computername [dns server] -rrtype cname | ? {$_.hostname -like "$dnscname*"} | format-table
this snippet query dns , return zones , pipe results get-dnsserverresourcerecord return records alias name (and it's variants) exists in.
for example: $dnscname='abcxyz'
the results are:
abcxyz.domain1.com abcxyz123.subdomain.domain1.com abcxyz456.subdomain.domain2.com
unfortunately following wmi query not work me.
"select * microsoftdns_resourcerecord ownername '%abcxyz%'"
is there way write wmi query return same results powershell script?
i'm 99% provider doesn't support filtering way (but can't find reference). you'll have of them , filter them in code, incidentally what's happening in powershell code (you're letting cmdlet, thin wrapper around wmi objects, return results , filtering using ?
/ where-object
).
Comments
Post a Comment