none
wmi filter in powwershell script RRS feed

  • Question

  • Good Morning,

    I'm trying to get computers records in my dns server using get-wmiobject : 

    Get-WMIObject -Computer '[DNSserver]' -Namespace "root\MicrosoftDNS" -Class "MicrosoftDNS_AType" -filter "OwnerName LIKE 'computer%'"

    But nothing is returned.

    someone have a idea ?

    Friday, December 13, 2013 10:37 AM

Answers

  • Get-WMIObject MicrosoftDNS_AType -ns  root\MicrosoftDNS | WHERE{$_.ownername -match 'b966'}

    ¯\_(ツ)_/¯


    • Edited by jrv Friday, December 13, 2013 3:45 PM
    • Proposed as answer by GastoneCanali Saturday, December 14, 2013 10:28 AM
    • Marked as answer by Bill_StewartModerator Tuesday, December 17, 2013 3:15 PM
    Friday, December 13, 2013 3:45 PM

All replies

  • What do you get if you remove the filter?

    Get-WMIObject MicrosoftDNS_AType -ns  root\MicrosoftDNS -computer servername | select ownername

    Do not use computername when running on the dns server.

    Quotes are only necessary when there are spaces in the string.


    ¯\_(ツ)_/¯


    • Edited by jrv Friday, December 13, 2013 11:48 AM
    • Proposed as answer by GastoneCanali Saturday, December 14, 2013 10:28 AM
    Friday, December 13, 2013 11:46 AM
  • Thanks for your answer, and after how can a get a "collection" of computer with a name like **b996 ?

    can i use a query in the select : like select * from $_ where ownername like %b996 ?

    Friday, December 13, 2013 3:21 PM
  • Get-WMIObject MicrosoftDNS_AType -ns  root\MicrosoftDNS | WHERE{$_.ownername -match 'b966'}

    ¯\_(ツ)_/¯


    • Edited by jrv Friday, December 13, 2013 3:45 PM
    • Proposed as answer by GastoneCanali Saturday, December 14, 2013 10:28 AM
    • Marked as answer by Bill_StewartModerator Tuesday, December 17, 2013 3:15 PM
    Friday, December 13, 2013 3:45 PM
  • thank's a lot , it works great
    Tuesday, December 17, 2013 7:30 AM