none
How to test a WMI Filter and see all the computers in the results?

    Frage

  • I have made a few WMI filters that that query based on computer name.  They have been pretty easy, just give me all the computers that contain IT in the name.

    SELECT * FROM Win32_ComputerSystem WHERE Name like '%it%'

    Its part of a GPO that is linked to the Desktop OU and not the Server OU.  

    But now my needs are getting a little complicated and i've always just trusted that the query worked and pulled the computers i wanted targeted.

    Is there a way to build a WMI Query, point it at an OU, and see what comes back in the query?

    Its more of future proofing to make sure only the computers i want are returned before I apply that filter to any GPO as my filters become more complex. 

    Donnerstag, 14. Juni 2018 20:30

Alle Antworten

  • might have a good chance with powershell invoke-wmimethod with a -whatif tag.
    Donnerstag, 14. Juni 2018 20:47
  • I have made a few WMI filters that that query based on computer name.  They have been pretty easy, just give me all the computers that contain IT in the name.

    SELECT * FROM Win32_ComputerSystem WHERE Name like '%it%'

    Its part of a GPO that is linked to the Desktop OU and not the Server OU.  

    But now my needs are getting a little complicated and i've always just trusted that the query worked and pulled the computers i wanted targeted.

    Is there a way to build a WMI Query, point it at an OU, and see what comes back in the query?

    Its more of future proofing to make sure only the computers i want are returned before I apply that filter to any GPO as my filters become more complex. 


    Use the Get-CimInstance cmdlet and use the -query paramter:
    https://docs.microsoft.com/en-us/powershell/module/cimcmdlets/get-ciminstance?view=powershell-6

    Donnerstag, 14. Juni 2018 21:10
  • > Is there a way to build a WMI Query, point it at an OU, and see what comes back in the query?

    No, but you can run the query on a computer that is in this OU. Easy to use: https://sdmsoftware.com/gpoguy/free-tools/library/wmi-filter-validation-utility/

    Freitag, 15. Juni 2018 12:01