PowerShell to find active computer objects by Operating System name

I have a need from time to time to find actively used computer objects in the domain that are running a particular operating system. Most often it is to find unsupported operating systems like XP, Server 2003 or even OSX 10.8 and below. The script looks a lot like: