I am using the following script to get screen resolution in Windows using WMI. The script works fine when the computer is in landscape mode but returns incorrect values when
Same as the other answers, however for the plain cmd:
wmic path Win32_VideoController get VideoModeDescription