Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to target and OS in GPO

Group Policy

How to target and OS in GPO

by  markdmac  Posted    (Edited  )
How to target an OS in a GPO

1) Create your WMI Filters for the target operating system
a) To create a WMI filter that queries for a specified version of Windows:
i) Click Start
ii) Click Administrative Tools
iii) Click Group Policy Management.
iv) In the navigation pane, expand Forest: YourForestName, expand Domains, expand YourDomainName, and then click WMI Filters.
b) Click Action, and then click New.
c) In the Name text box, type the name of the WMI filter.
d) Click Add.
e) Leave the Namespace value set to root\CIMv2.
f) In the Query text box, type:
(1) select * from Win32_OperatingSystem where Version like "6.%"

This query uses a wildcard by looking for all operating systems starting with 6. and will return true for computers running Windows 7, Windows Vista, Windows Server 2008, and Windows Server 2008 R2.

To specify multiple versions, combine them with æorÆ, as shown in the following:

select * from Win32_OperatingSystem where Version like "6.0%" or Version like "5.2%"

OS Specific Query Strings You Can Use
Win7: select * from Win32_OperatingSystem where Version like "6.1%" and ProductType="1"
Vista: select * from Win32_OperatingSystem where Version like "6.0%" and ProductType="1"
XP: select * from Win32_OperatingSystem where Version like "5.1%"
2003 non DC: select * from Win32_OperatingSystem where Version like "5.2%" and ProductType="3"
All non DC: select * from Win32_OperatingSystem where ProductType="1" or ProductType="3"

g) Click OK to save the query to the filter.
h) Click Save to save your completed filter.

For supporting information check the following link.
http://technet.microsoft.com/en-us/library/cc947846%28WS.10%29.aspx

2) Create your GPO's and link them to the relevant OU

3) Apply the WMI filter to the GPO
a) In GPMC, select the GPO and on the SCOPE tab use the WMI drop down to select your previously created WMI filter.
4) Run gpupdate on the target to refresh group policies, use SpecOps GPUpdate for remote refresh.
http://www.specopssoft.com/products/specops-gpupdate

You can further target systems by modifying the query string. For example you might want to select the Operating System based on 32 bit / 64 bit OS types.

Target Win 7 32 bit machines:
select * from Win32_OperatingSystem WHERE Version like "6.1%" AND ProductType="1" AND NOT OSArchitecture = "64-bit"
Target Win 7 64Bit machines:
select * from Win32_OperatingSystem WHERE Version like "6.1%" AND ProductType="1" AND OSArchitecture = "64-bit"
Target any 32 bit OS:
SELECT AddressWidth FROM Win32_Processor WHERE AddressWidth ='32'
Target any 64Bit OS:
SELECT AddressWidth FROM Win32_Processor WHERE AddressWidth ='64'
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top