Solved

WMI Query for specific letter in devicename

Posted on 2014-03-18
4
398 Views
Last Modified: 2014-04-23
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
0
Comment
Question by:juriang
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 10

Accepted Solution

by:
bigbigpig earned 500 total points
ID: 39936888
select * from Win32_ComputerSystem where Name like '_____T%'

Those are 5 underscores, 6th character is a T, and the % means it doesn't matter what's after the T.
0
 

Author Comment

by:juriang
ID: 39936968
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?
0
 
LVL 10

Expert Comment

by:bigbigpig
ID: 39937055
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.
0
 

Author Closing Comment

by:juriang
ID: 40017471
This worked as required.
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will be converting StringData saved within a text file into a hash table. This can be further used in a PowerShell script for replacing settings that are dynamic in nature from environment to environment.
What do responsible coders do? They don't take detrimental shortcuts. They do take reasonable security precautions, create important automation, implement sufficient logging, fix things they break, and care about users.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Suggested Courses

628 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question