Getting Screen Information

by Jul 15, 2013

Ever needed to know the current screen resolution or related screen information?

Here's an easy way of getting that information:

Add-Type -AssemblyName System.Windows.Forms
[System.Windows.Forms.Screen]::AllScreens
[System.Windows.Forms.Screen]::PrimaryScreen 

Note that AllScreens returns a screen object for each active screen, so you can also use this to find out the number of screens in use:

[System.Windows.Forms.Screen]::AllScreens | Measure-Object | Select-Object -ExpandProperty Count 

Twitter This Tip! ReTweet this Tip!