Link to home
Start Free TrialLog in
Avatar of juriang
juriangFlag for Netherlands

asked on

WMI Query for specific letter in devicename

Hi,

i'm trying to create a WMI query to check if the 6th character of the device name contains the letter T

To explain... I need this query to apply a GPO to tablet devices. In our device naming convention we specify what type of device it is on the 6th character (T for tablets, N for notebooks, etc)

Using the chassis type value (showed below) from WMI does not work for me as some of our tables are showing as laptops in WMI

SELECT * FROM Win32_SystemEnclosure
ChassisTypes

Open in new window


Of course i'm able to query the full computer name with below query

SELECT * FROM Win32_Computersystem
Name

Open in new window


But how to check now if the 6th character is a T or not?

Please help.
Thanks,

Jurian
ASKER CERTIFIED SOLUTION
Avatar of bigbigpig
bigbigpig

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of juriang

ASKER

Hi Guru,

Thanks for you input....

Strange thing is that this query you suggested works great in my WMI explorer but when I use this query within a WMI filter in the group policy management console and test it it still give the value true even when the 6th character is an N.

Any idea?
Avatar of bigbigpig
bigbigpig

What GP objects are you applying based on the filter?  Did you force refresh of the policies on the client machines in test?  Run a gpresult /r on one of them and reboot it and see if the the gpresult after that says it's filtered out.
Avatar of juriang

ASKER

This worked as required.