1

I'm trying to apply a wmi filter to a group policy using this command:

Select * from Win32_Processor where AddressWidth = '64' 

This will only apply the GPO to 64 bit machines (all of our machines are Windows 7) when the filter is linked. However, the GPO is not applying and when I run the select statement on the machine I get:

Select is not recognized as an internal or external command, operable program, or batch file.

I know this has something to do with environmental variables, however I'm not sure how to assign this particular one if that is the case.

Any help would be greatly appreciated!

2 Answers 2

0

I know this has something to do with environmental variables

Wherever that knowledge came from, it is wrong.

Your SELECT statement is a WMI query, in a language named WQL (a subset of SQL). You don't just type it in at the prompt of the cmd command interpreter. cmd interprets a completely different language. You cannot go randomly giving commands in one computer language to a tool that speaks another completely different one. That's not how computers work.

Further reading

2
  • Thanks, that makes sense. Apparently the issue is elsewhere on my WMI filter. Feb 28, 2014 at 3:07
  • WMI commands can be run from CMD by prefacing with the command interpreter, i.e. "WMIC <command>". See technet.microsoft.com/en-us/library/bb742610.aspx#ECAA for easy help. However, your SELECT is WMI SQL -- see msdn.microsoft.com/en-us/library/aa394606%28v=vs.85%29.aspx for how to use WMI SQL (WQL). The first cite gives specific info on using WMIC to determine processor, which seems your goal. These work similar to the way you can run a Powershell cmdlet or script from the command line, i.e. by prefacing with "powershell.exe" and appropriate switches and parameters.
    – Debra
    Feb 28, 2014 at 4:23
1

It is as JdeBP has stated. You need to use a tool that can handle your WQL (sql-like) statement. You could switch from using the cmd.exe command shell and use the powershell.exe command shell to run your query. It offers a cmdlet that allows for processing of WQL statements. Try this:

Open your command window and type in Powershell and hit enter. This will cause an instance of powershell to run inside of your current cmd session. Now that you are in powershell, you can use the Get-WmiObject commandlet to query for your information:

get-wmiobject -query "select * from win32_processor where addresswidth='64'"

and hit enter. This should return you the information you are trying to get at. Once you are done, you can type exit to end the powershell session you were running inside of your cmd session.

Note that you also can open Powershell directly instead of going thru cmd.exe. just type "Powershell" in the Run box or the search field at the bottom of the start menu, and a powershell window will open up on your screen, just like if you use cmd.exe.

If for some reason you are unable to bring up powershell, you could check and make sure it is installed. On my Win 7 install it lives here:

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe

Hope this helps,

Related reading:

Powershell Introduction

About the Get-WmiObject cmdlet

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .