I wanted a clean and simple way to prevent group policies applying during an automated build process. This is because it can potentially cause some of the components of the build process to fail. One of the last tasks to run on all servers built using my unattended build method will stamp the registry with the build version and date, so I was pretty eager to implement a WMI filter that would read the build version to determine whether or not the policy should apply. Easier said than done! I found a great article on WMI Filters that went into the requirements and gave an example, but I found that I still needed to do a considerable amount of research in order for everything to start making sense.
Copy the below MOF file to…
%SystemRoot%\System32\wbem
Compile it by typing…
Mofcomp -class:forceupdate BuildInfo.mof
Test it by typing…
Wmic path BuildInfo WHERE (BuildVersion Like “2.%”) get BuildVersion
This will return the build number from the registry for all 2.x builds
WMI Filter will be…
select * from BuildInfo where (BuildVersion Like “2.%”)
This will return True for all version 2.x builds
Please review the MOF file below. It is fully documented, and will help anyone who wants to implement the same process.
Enjoy!
Read more