function getDisplayOrientation(strComputer) set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") set colItems = objWMIService.ExecQuery("Select * from Win32_DesktopMonitor",,0) for each objItem In colItems intWidth = objItem.ScreenWidth intHeight = objItem.ScreenHeight next if (intWidth < intHeight) then msgbox "portrait" if (intWidth > intHeight) then msgbox "landscape" end function