Posted on 10-21-2015 07:26 AM
Hi All
I used to have an ARD script that was able to report on installed Graphics Hardware on any mac hardware...typically I've misplaced this so wondered if anyone had tried this before or even better might have incorporated Graphics Card reporting into Casper Hardware inventory?
Cheers
Solved! Go to Solution.
Posted on 10-21-2015 07:41 AM
Hmm. Not sure that there is anything built into the Casper Suite that reports on that. Looking thru a few records I don't see any mention of the graphics cards and VRAM, for example.
You could add an Extension Attribute. This is not well tested, so I don't know how reliable it would be against all types of Macs, but try this-
#!/bin/sh
echo "<result>$(system_profiler SPDisplaysDataType | awk '/Chipset Model/,/Displays/{print}' | sed '$d;s/^ *//g')</result>"
Posted on 10-21-2015 07:41 AM
Hmm. Not sure that there is anything built into the Casper Suite that reports on that. Looking thru a few records I don't see any mention of the graphics cards and VRAM, for example.
You could add an Extension Attribute. This is not well tested, so I don't know how reliable it would be against all types of Macs, but try this-
#!/bin/sh
echo "<result>$(system_profiler SPDisplaysDataType | awk '/Chipset Model/,/Displays/{print}' | sed '$d;s/^ *//g')</result>"
Posted on 10-21-2015 07:56 AM
@mm2270's is pretty much the same as the one I used except I awk instead of sed:
#!/bin/bash
# Returns the GPU chipset for a Mac. Because Macs may have two chipsets for discrete switching
# the last result is what is always returned (Intel HD Graphics are always the first result)
echo "<result>${/usr/sbin/system_profiler SPDisplaysDataType | awk -F': ' '/Chipset Model/ {print $2}' | tail -1}</result>"
exit 0
Posted on 10-21-2015 08:08 AM
Thanks for the replies, I'll check these out
Posted on 08-05-2016 06:03 AM
We had a request to report on which Macs have dedicated graphics card.
Cobbled something together based this, and other posts:
#!/bin/sh
system_profiler SPDisplaysDataType | grep 'Chipset Model:' | cut -f2- -d':' | tr -d ' '
Output from Terminal shows proper carriage return:
$ system_profiler SPDisplaysDataType | grep 'Chipset Model:' | cut -f2- -d':' | tr -d ' '
AMDRadeonR9M370X
IntelIrisPro
When you bring up the computer in JSS you see:
When you view the computer in a list with the EA displayed, the column loses its line returns:
Is there a way to force the column to preserve the line return for this EA?
TIA,
Don
Posted on 08-05-2016 06:07 AM
To be honest, an EA outputting either of these two values would be fine as well:
"BuiltIn" for computers that only have built in graphics; "PCIe" for computers that have a dedicated graphics card.
Posted on 08-05-2016 01:42 PM
Something like this?
#!/usr/bin/python
import subprocess
p = subprocess.Popen(['system_profiler', 'SPDisplaysDataType'], stdout=subprocess.PIPE)
output, err = p.communicate()
count = len([x for x in output.split('
') if 'Chipset Model' in x])
print('<result>{}</result>'.format('BuiltIn' if count < 2 else 'PCIe'))
Posted on 02-10-2017 11:35 AM
For what it's worth, I had problems with this on Sierra until I modified the script a bit. This works well for me:
#!/bin/bash
# Returns the GPU chipset for a Mac. Because Macs may have two chipsets for discrete switching
# the last result is what is always returned (Intel HD Graphics are always the first result)
vidcard=`/usr/sbin/system_profiler SPDisplaysDataType | awk -F': ' '/Chipset Model/ {print $2}' | tail -1`
echo "<result>$vidcard</result>"
exit 0
Posted on 02-17-2021 10:43 AM
Sorry to bring up an old thread but I didn't find anything more current. I am trying to get egjerde's solution to work but probably missing a step. I created an EA with the following settings:
Display Name: GPU
Enabled: Yes
Data Type: String
Inventory Display: Hardware
Input Type: Script
Mode: Shell
Then pasted the above script from egjerde and saved. The new EA does not display the GPU for any enrolled machine. Also tried all of the previously mentioned scripts in this thread. Am I missing something or does the script no longer work on newer OS's?
Posted on 03-01-2021 03:41 PM
@steagle , try removing the exit command and see if that works.