Category Archives: WMI

Using Powershell to log Processor Temperature

I needed to log the temperature of the processor.  I found a Powershell function that could be used, but listed more information than I needed, so I modified it.  The original function can be found here. (new window).  I modified the function to only grab the temperature in Celsius, and added a log to file with Date/Time detail, as well as allow multiple processor sensors to be recorded.
This is also an example of using New-Object and Add-Member
The script can be found on pastebin here. (new window)

WMI Filters for Operating Systems

EDIT: Added windows 10

Here is a list of WMI filters for Operating Systems.  You can follow instructions here to create them.
Windows 2000
SELECT version FROM Win32_OperatingSystem WHERE Version LIKE “5.0%”
Windows XP 32 bit
SELECT version FROM Win32_OperatingSystem WHERE Version LIKE “5.1%” and ProductType = “1”

Windows XP 64 bit
SELECT version FROM Win32_OperatingSystem WHERE Version LIKE “5.1%” and ProductType = “1”

Server 2003 32 bit
SELECT version FROM Win32_OperatingSystem WHERE Version LIKE “5.1%” and NOT ProductType = “1”

Server 2003 64 bit
SELECT version FROM Win32_OperatingSystem WHERE Version LIKE “5.1%” and NOT ProductType = “1” AND NOT OSArchitecture = “64-bit”

Windows Vista 32bit
SELECT version FROM Win32_OperatingSystem WHERE Version LIKE “6.0%” and ProductType = “1” AND NOT OSArchitecture = “64-bit”

Windows Vista 64bit
SELECT version FROM Win32_OperatingSystem WHERE Version LIKE “6.0%” and ProductType = “1” AND OSArchitecture = “64-bit”

Server 2008 32bit
SELECT version FROM Win32_OperatingSystem WHERE Version LIKE “6.0%” and NOT ProductType = “1” AND NOT OSArchitecture = “64-bit”

Server 2008 64bit
SELECT version FROM Win32_OperatingSystem WHERE Version LIKE “6.0%” and NOT ProductType = “1” AND OSArchitecture = “64-bit”

Windows 7 32bit
SELECT version FROM Win32_OperatingSystem WHERE Version LIKE “6.1%” and ProductType = “1” AND NOT OSArchitecture = “64-bit”

Windows 7 64bit
SELECT version FROM Win32_OperatingSystem WHERE Version LIKE “6.1%” and ProductType = “1” AND OSArchitecture = “64-bit”

Server 2008 R2
SELECT version FROM Win32_OperatingSystem WHERE Version LIKE “6.1%” and NOT ProductType = “1”

Windows 8 32 bitSELECT version FROM Win32_OperatingSystem WHERE Version LIKE “6.2%” and ProductType = “1” AND NOT OSArchitecture = “64-bit”
Windows 8 64 bit
SELECT version FROM Win32_OperatingSystem WHERE Version LIKE “6.2%” and ProductType = “1” AND OSArchitecture = “64-bit”

Server 2012
SELECT version FROM Win32_OperatingSystem WHERE Version LIKE “6.2%” and NOT ProductType = “1”

Windows 8.1 32 bit
SELECT version FROM Win32_OperatingSystem WHERE Version LIKE “6.3%” and ProductType = “1” AND NOT OSArchitecture = “64-bit”

Windows 8.1 64 bit
SELECT version FROM Win32_OperatingSystem WHERE Version LIKE “6.3%” and ProductType = “1” AND OSArchitecture = “64-bit”
Server 2012 R2
SELECT version FROM Win32_OperatingSystem WHERE Version LIKE “6.3%” and NOT ProductType = “1”
Windows 10
SELECT version FROM Win32_OperatingSystem WHERE Version LIKE “10.%” and ProductType = “1”

Reference:
http://msdn.microsoft.com/en-us/library/aa394239(v=vs.85).aspx
http://technet.microsoft.com/en-us/library/jj899801.aspx

Create a Group Policy WMI filter to determine 64 bit or 32 bit Operating System

I needed to create a WMI filter for Group Policy that would separate 64 bit and 32 bit Operating Systems.

Source: http://community.spiceworks.com/how_to/show/1432-using-wmi-filters-to-apply-group-policy-to-a-target-operating-system

Open Group Policy Management.  Expand the Forest and Domain, down to WMI Filters.



Right click WMI Filters and select New…



Type a Name (for 64 bit operating systems) for the Filter and a Description.  Click Add



Leave the Namespace as rootCIMv2

Type the Query

SELECT AddressWidth FROM Win32_Processor WHERE AddressWidth =’64’  and click OK



Click Save

 

Repeat the process, for 32 bit Operating Systems.  The Query is:

SELECT AddressWidth FROM Win32_Processor WHERE AddressWidth =’32’.

This can then be applied to a Policy



Some handy WMI filters for further separation:

Windows 7 32 bit:

select * from Win32_OperatingSystem WHERE Version like “6.1%” AND
ProductType=”1″ AND NOT OSArchitecture = “64-bit”

Windows 7 64 bit:

select * from Win32_OperatingSystem WHERE Version like “6.1%” AND
ProductType=”1″ AND OSArchitecture = “64-bit”

Windows 8 32 bit:

select * from Win32_OperatingSystem WHERE Version like “6.2%” AND
ProductType=”1″ AND NOT OSArchitecture = “64-bit”

Windows 8 64 bit:

select * from Win32_OperatingSystem WHERE Version like “6.2%” AND
ProductType=”1″ AND OSArchitecture = “64-bit”