Posted on 01-17-2011 11:54 AM
I know ARD can do this...does anyone know how to make an Extension Attribute to pull the monitor resolution?
Thanks in advance! :)
Don
Posted on 01-17-2011 12:40 AM
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/>
Posted on 01-17-2011 12:53 AM
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
Posted on 01-17-2011 01:00 PM
This did the trick:
---------------------------------
#!/bin/sh
echo "<result>/usr/sbin/system_profiler SPDisplaysDataType | awk -F: '/Resolution/ {print $2}'
</result>"
---------------------------------
Thanks,
Don
Posted on 01-17-2011 02:11 PM
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
Posted on 01-18-2011 09:44 PM
Then just use a regular expression to narrow down your results to what you need..
Posted on 01-18-2011 09:50 PM
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
Posted on 06-12-2012 06:19 PM
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>" & intHorizontal&"x"&intVertical & "</result>"