Windows Server TechCenter > Windows Server Forums > Group Policy > How to make a WMI filter to apply to computers of a certain age
Ask a questionAsk a question
 

AnswerHow to make a WMI filter to apply to computers of a certain age

  • Tuesday, November 03, 2009 9:22 AMKruger44 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    I'm looking to WMI to create a filter for some AD GPO's. Basicly I need to filter out freshly installed computers. I want a GPO to apply to computer that is older than 4 hours.

    The Win32_OperatingSystem Class seems to have relevant properties like InstallDate and LocalDateTime. Does anyone have a tip on how to bring arithmetic into the syntax so I can compare the two properties and determine the current age of the computer?

Answers

  • Wednesday, November 04, 2009 10:13 AMMervyn ZhangMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Hi,

    The following command query if the age of the system is older than 4 hours. However, it doesn’t work with WMI filtering. WMI filtering only support simple query.

    Select * from Win32_OperatingSystem where (( left(LocalDateTime,10)-left(installdate,10)) >4)

    Please let us know the detailed policy you would like to deploy so that we could try to find a workaround.

    Thanks.

    This posting is provided "AS IS" with no warranties, and confers no rights.

All Replies

  • Wednesday, November 04, 2009 10:13 AMMervyn ZhangMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Hi,

    The following command query if the age of the system is older than 4 hours. However, it doesn’t work with WMI filtering. WMI filtering only support simple query.

    Select * from Win32_OperatingSystem where (( left(LocalDateTime,10)-left(installdate,10)) >4)

    Please let us know the detailed policy you would like to deploy so that we could try to find a workaround.

    Thanks.

    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Monday, November 09, 2009 6:12 AMMervyn ZhangMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi,

    Do you need any other assistance? If there is anything we can do for you, please let us know.

    Thanks.

    This posting is provided "AS IS" with no warranties, and confers no rights.