Reporting on Graphics Card or GPU Hardware installed on Mac Clients

mfadmin
New Contributor

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

1 ACCEPTED SOLUTION

mm2270
Legendary Contributor II

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>"

View solution in original post

9 REPLIES 9

mm2270
Legendary Contributor II

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>"

View solution in original post

BrysonTyrrell
Contributor II

@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

mfadmin
New Contributor

Thanks for the replies, I'll check these out

donmontalvo
Esteemed Contributor II

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:

1d0d7908d9ca4721979d784120e1646b

When you view the computer in a list with the EA displayed, the column loses its line returns:

d39f5e9f11be43348e6c5dbce67e0602

Is there a way to force the column to preserve the line return for this EA?

TIA,
Don

--
https://donmontalvo.com

donmontalvo
Esteemed Contributor II

To be honest, an EA outputting either of these two values would be fine as well:

  • BuiltIn
  • PCIe

"BuiltIn" for computers that only have built in graphics; "PCIe" for computers that have a dedicated graphics card.

--
https://donmontalvo.com

BrysonTyrrell
Contributor II

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'))

egjerde
New Contributor III

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

steagle
New Contributor II

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?

SureExclamation
New Contributor II

@steagle , try removing the exit command and see if that works.