Jump to content

Recommended Posts

Posted

Hello,

 

I am wondering if anyone has a working WMI filter that queries what the computer hostname begins with please?

 

For example if the computer hostname is Room-PC01 I would like a filter that picks up Room-PC*

 

Many Thanks

Posted

Namespace: root\CIMv2
Query: Select * FROM Win32_ComputerSystem WHERE Name LIKE "Room-PC%"

 

You can also do multiple name types like this...

 

Select * FROM Win32_ComputerSystem WHERE ((Name LIKE "Room-PC%") OR (Name LIKE "Room-Laptop%"))

  • Thanks 1
Posted

Thanks. How would I adopt it so it only applies if it doesn't begin with that room number please? Is it the below please?

 

Select * FROM Win32_ComputerSystem WHERE Name NOT LIKE "Room-PC%"

Posted
Thanks. How would I adopt it so it only applies if it doesn't begin with that room number please? Is it the below please?

 

Select * FROM Win32_ComputerSystem WHERE Name NOT LIKE "Room-PC%"

 

Close

 

Select * FROM Win32_ComputerSystem WHERE NOT Name LIKE "Room-PC%"

  • Thanks 1
Posted

Also, if you want the query to execute faster change the * to Name... :)

 

Select [color="#FF0000"]Name[/color] FROM Win32_ComputerSystem WHERE NOT Name LIKE "Room-PC%"

  • Thanks 1
Posted

Am I being thick here - This WMI doesn't seem to work?

 

Any suggestions please?

 

Thanks

 

Select Name FROM Win32_ComputerSystem WHERE ((Name LIKE "WA-%") OR (Name LIKE "SA-%") OR (Name LIKE "KA-%"))

Posted
Select Name FROM Win32_ComputerSystem WHERE ((Name LIKE "WA-%") OR (Name LIKE "SA-%") OR (Name LIKE "KA-%"))

Does the following query work for you?

 

Select Name FROM Win32_ComputerSystem WHERE Name LIKE "WA-%" OR Name LIKE "SA-%" OR Name LIKE "KA-%"

Posted
Is there a quick way to validate it without tampering with the group policy please?

Try this PowerShell...

 

Get-WmiObject -Query 'Select Name FROM Win32_ComputerSystem WHERE Name LIKE "WA-%" OR Name LIKE "SA-%" OR Name LIKE "KA-%"'

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...