Skip to main content
Question

Extension Attribute to pull monitor resolution?

  • January 17, 2011
  • 7 replies
  • 50 views

donmontalvo
Forum|alt.badge.img+36

I know ARD can do this...does anyone know how to make an Extension Attribute to pull the monitor resolution?

Thanks in advance! :)

Don

7 replies

Forum|alt.badge.img+7

system_profiler SPDisplaysDataType | grep Resolution

Will get you your resolution. You can pop this into a script for a custom
extension attribute.

Still some work needed on your part for the script, but this gets you down
to where you want to look for the display(s) resolution(s)

-Lance

--
Lance Ogletree
Systems Engineer
Mobile: (972) 342-5990
Direct: (972) 547-9566
lance.ogletree at jamfsoftware.com
lanceo at mac.com(iChat)
....................................................................
JAMF Software
1011 Washington Ave. S
Suite 350
Minneapolis, MN 55415
....................................................................
Office: (612) 605-6625
Facsimile: (612) 332-9054
....................................................................
US Support: (612) 216-1296
....................................................................
http://www.jamfsoftware.com <http://www.jamfsoftware.com/>


donmontalvo
Forum|alt.badge.img+36
  • Author
  • Hall of Fame
  • January 17, 2011

Thanks Lance,

Google is your friend...

http://discussions.apple.com/thread.jspa?threadID=2721442&tstart=60

Here's the command to pull the current resolution of monitor(s):

system_profiler SPDisplaysDataType | awk -F: '/Resolution/ {print $2}'

I guess I'll need to cobble together the Extension Attributes...one moment while I roll up my sleeves...

Don


donmontalvo
Forum|alt.badge.img+36
  • Author
  • Hall of Fame
  • January 17, 2011

This did the trick:

---------------------------------
#!/bin/sh
echo "<result>/usr/sbin/system_profiler SPDisplaysDataType | awk -F: '/Resolution/ {print $2}'</result>"
---------------------------------

Thanks,
Don


Forum|alt.badge.img+31
  • Honored Contributor
  • January 17, 2011

The only problem with grep is that it can be too broad, and it can grab anything and everything that has the string Resolution in it. If you are running dual displays or hooked up to a projector when it runs this may cause issue. Of course I have not tested it, but for example if I did a grep for connections using port 548 it may grab these ports on a network connection:

1548
33548
153248

Since the string 548 is in all of those you may get wonky results.

just FYI

-Tom


Forum|alt.badge.img+7
  • Employee
  • January 19, 2011

Then just use a regular expression to narrow down your results to what you need..


Forum|alt.badge.img+7
  • Employee
  • January 19, 2011

For anyone that's interested here is a resource on using it

http://www.wellho.net/regex/grep.html

http://www.robelle.com/smugbook/regexpr.html

Cheers
John


Forum|alt.badge.img+18
  • Esteemed Contributor
  • June 13, 2012

Tweaked this extension attribute a bit so it will also pull windows machines screen resolutions as well. Just paste this in the VBScript field after doing the above for the mac:

Set objWMIService = GetObject("Winmgmts:. ootcimv2") Set colItems = objWMIService.ExecQuery("Select * From Win32_DesktopMonitor where DeviceID = 'DesktopMonitor1'",,0) For Each objItem in colItems intHorizontal = objItem.ScreenWidth intVertical = objItem.ScreenHeight Next
WScript.Echo "<result>" &amp; intHorizontal&amp;"x"&amp;intVertical &amp; "</result>"