The below script will find the screen aspect ratio of a computers primary video controller by querying WMI.

The script stores the horizontal and vertical resolution for each video controller in an array and returns the result of dividing the horizontal by the vertical for the first controller. If the computer has any other controllers there resolutions will also be in the array.

You could modify this script and use it for a few different purposes, I have used this method to deploy wallpapers to computers with the correct aspect ratio.