Hello
To apply a WMI filter to a group of computers, you can use the Win32_ComputerSystem class and the Name property in your WMI query. However, it seems like you’re having trouble getting the query to select the correct group of computers.
Here are some steps you can follow to troubleshoot this issue:
Verify the Computer Names: Ensure that the computer names you’re using in your WMI query match exactly with the names of the computers in your domain. Computer names are case-sensitive.
Test Your WMI Query: You can test your WMI query on an individual computer before applying it to a group. For example, you can use the Get-WmiObject cmdlet in PowerShell to run your WMI query. Here’s an example:
Get-WmiObject -Query "SELECT * FROM Win32_ComputerSystem WHERE Name = 'PC01'"
This command should return information about the computer named ‘PC01’. If it doesn’t return any results, then there might be an issue with your WMI query or the computer name.
Use a Loop to Query Multiple Computers: If you want to apply your WMI filter to a group of computers, you can use a loop in PowerShell to run your WMI query on each computer. Here’s an example:
$computers = 'PC01', 'PC02', 'PC03' # Replace with your computer names
foreach ($computer in $computers) {
Get-WmiObject -ComputerName $computer -Query "SELECT * FROM Win32_ComputerSystem WHERE Name = '$computer'"
}
This script will run your WMI query on each computer in the $computers array.
Check for Errors: If there are any errors when running your WMI query, they should be displayed in the PowerShell console. These errors can help you troubleshoot any issues with your WMI filter.
Remember, any changes made by Group Policy may take some time to propagate throughout your network. You can force an immediate update by running gpupdate /force on the affected computers.