Nick I found an error in that script. Change this line:
tabletExists="system_profiler | grep WACOM"
To this:
tabletExists=system_profiler | grep WACOM
Steve Wood
Director of IT
swood at integer.com
The Integer Group | 1999 Bryan St. | Ste. 1700 | Dallas, TX 75201
T 214.758.6813 | F 214.758.6901 | C 940.312.2475
Perfect timing, I was just scratching my head cause all were coming back positive.
In the Extension Attribute setup page.
* Should "Data Type" be set to String or Integer?
Nick Caro Senior Desktop Support Administrator
String, since the result coming back is Yes or No.
On Mon, Sep 19, 2011 at 2:09 PM, Nick Caro <Nick.Caro at rga.com> wrote:
Steve Wood
Director of IT
swood at integer.com
The Integer Group | 1999 Bryan St. | Ste. 1700 | Dallas, TX 75201
T 214.758.6813 | F 214.758.6901 | C 940.312.2475
It was a script that I had thrown together last August:
On Mon, Sep 19, 2011 at 12:35 PM, Nick Caro <Nick.Caro at rga.com> wrote:
#!/bin/sh
tabletExists="system_profiler | grep WACOM"
if [ "$tabletExists" != "" ];
then
echo "<result>Yes</result>"
else
echo "<result>No</result>"
fi
exit 0
I would double check it to see if it still works as expected.
Steve Wood
Director of IT
swood at integer.com
The Integer Group | 1999 Bryan St. | Ste. 1700 | Dallas, TX 75201
T 214.758.6813 | F 214.758.6901 | C 940.312.2475
Many thanks!
I appreciate it the help.
Nick Caro Senior Desktop Support Administrator
Cool! Well, at least, I imagine with a pair of Oakleys I would be cooler than with a bunch of sed lines :)
Sean
You'd imagine...
;P
Regards,
Ben.
Or a pair with a SED line etched into them.
------------------------------
Tom Tubbiola
Special Technical Services (STS Team)
Ttubbiola at oakley.com
949.900.7705
naw, he needs this etched into it
chown -R us /.base
it is a clever geeky unix joke
Just googled it.
Yep I was right... Do I win a coconut or something?
Regards,
Ben.
Somebody set us up the *.bom.
--
BKV
You may find this useful!
Sean
#!/bin/bash
echo -n "<result>"
system_profiler SPUSBDataType | grep -B 3 -i wacom | awk 'NR%5==1' |
sed -e 's/^[ ]//' |
#sed -e 's/USB Bus://' |
#sed -e 's/USB High-Speed Bus://' |
sed -e 's/XD-0405-U/Intuos2 A6/g' |
sed -e 's/XD-0405-R/Intuos2 A6/g' |
sed -e 's/XD-0608-U/Intuos2 A5/g' |
sed -e 's/XD-0608-R/Intuos2 A5/g' |
sed -e 's/XD-0912-U/Intuos2 A4/g' |
sed -e 's/XD-0912-R/Intuos2 A4/g' |
sed -e 's/XD-1212-U/Intuos2 A4 Oversize/g' |
sed -e 's/XD-1212-R/Intuos2 A4 Oversize/g' |
sed -e 's/XD-1218-U/Intuos2 A3/g' |
sed -e 's/XD-1218-R/Intuos2 A3/g' |
sed -e 's/PTZ-430/Intuos3 A6/g' |
sed -e 's/PTZ-431W/Intuos3 A6 Wide/g' |
sed -e 's/PTZ-630/Intuos3 A5/g' |
sed -e 's/PTZ-631W/Intuos3 A5 Wide/g' |
sed -e 's/PTZ-930/Intuos3 A4/g' |
sed -e 's/PTZ-1230/Intuos3 A4 Oversize/g' |
sed -e 's/PTK-440/Intuos4 S/g' |
sed -e 's/PTK-640/Intuos4 M/g' |
sed -e 's/PTK-840/Intuos4 L/g' |
sed -e 's/PTK-1240/Intuos4 XL/g' |
sed -e 's/CTH-460/Bamboo Pen&Touch/g' |
sed -e 's/CTH-461/Bamboo Craft/g' |
sed -e 's/CTH-661/Bamboo Fun Pen&Touch/g' |
sed -e 's/DTZ-1200W/Cintiq-12WX Intuos3/g' |
sed -e 's/DTZ-2100/Cintiq-21UX Intuos3/g' |
sed -e 's/DTK-1200W/Cintiq-12WX Intuos4/g' |
sed -e 's/DTK-2100/Cintiq-21UX Intuos4/g' |
sed -e '/^$/d' |
sed -e 's/(.)./1/'
echo "</result>"
W o W !!!
That is awesome!
Thank you.
Nick Caro Senior Desktop Support Administrator
What Nick said, thanks for this.
------------------------------
Tom Tubbiola
Special Technical Services (STS Team)
Ttubbiola at oakley.com
949.900.7705
Wow is right!
So we just add the ext attribute as a script and string and then run
inventory recons?
John Wojda
Lead System Engineer, DEI & Mobility
3333 Beverly Rd. B2-338B
Hoffman Estates, IL 60179
Phone: (847)286-7855
Page: (224)532.3447
Team Lead DEI: Matt Beiriger
<mailto:mbeirig at searshc.com;jwojda at searshc.com?subject=John%20Wojda%20Fe
edback&body=I%20am%20contacting%20you%20regarding%20John%20Wojda.>
Team Lead Mobility: Chris
<mailto:cstaana at searshc.com;jwojda at searshc.com?subject=John%20Wojda%20Fe
edback&body=I%20am%20contacting%20you%20regarding%20John%20Wojda.> Sta
Ana
Mac Tip/Tricks/Self Service & Support
<http://bit.ly/gMa7TB>
"Any time you choose to be inflexible in your approach to an
unpredictable project you are already building failure into your plan"
Don't suppose that's worth a free pair of Oakley's
;)
Sean
Anything is possible. :-)
haha nice sed wizardry there
If I may be so bold to ask - what are the various commands? The man
page only tells so much (almost all of it over my head) - a real script
is easier to relate to why you chose particular commands over others.
I'm seeing a lot of / and 's and NR%5 ... but I don't know understand
the logic behind them. It would be good to know so as new Wacoms come
out I can continue to update the info to reflect newer hardware.
system_profiler SPUSBDataType | grep -B 3 -i wacom | awk 'NR%5==1' |
sed -e 's/^[ ]*//' |
#sed -e 's/USB Bus://' |
#sed -e 's/USB High-Speed Bus://' |
sed -e 's/XD-0405-U/Intuos2 A6/g' |
John Wojda
Lead System Engineer, DEI & Mobility
3333 Beverly Rd. B2-338B
Hoffman Estates, IL 60179
Phone: (847)286-7855
Page: (224)532.3447
Team Lead DEI: Matt Beiriger
<mailto:mbeirig at searshc.com;jwojda at searshc.com?subject=John%20Wojda%20Fe
edback&body=I%20am%20contacting%20you%20regarding%20John%20Wojda.>
Team Lead Mobility: Chris
<mailto:cstaana at searshc.com;jwojda at searshc.com?subject=John%20Wojda%20Fe
edback&body=I%20am%20contacting%20you%20regarding%20John%20Wojda.> Sta
Ana
Mac Tip/Tricks/Self Service & Support
<http://bit.ly/gMa7TB>
"Any time you choose to be inflexible in your approach to an
unpredictable project you are already building failure into your plan"
there are whole books dedicated to awk and sed. They basically
manipulate text and strings and are very powerful binaries. You can do
comparisons, mathematics, regex, substitution/manipulation, and so much
more. These two commands are basically a whole programming language with
in itself. I own this book and suggest it to anyone wanting to learn
more.
http://shop.oreilly.com/product/9781565922259.do
For the geek history of it, sed stands for stream editor and awk stands
for: Aho, Weinberger and Kerrighan which are the last names of the 3
dudes that developed it. The command `grep` actually comes from sed,
because grep used to be a very popular switch used with sed to pull out
strings with in a data set, g/re/p was a common string in sed, which
was for global regular expression print. Thankfully wikipedia is
around to teach me these things!
-Tom
If you have more than one device connected (some of our users have Cintiqs and standard tablets) then you'd have an output like:
system_profiler SPUSBDataType | grep -B 3 -i wacom
XD-0608-U:
Product ID: 0x0042
Vendor ID: 0x056a (WACOM Co., Ltd.)
--
PTZ-630:
Product ID: 0x00b1
Vendor ID: 0x056a (WACOM Co., Ltd.)
awk 'NR%5==1'
lists the 1 line of each block of 5
So
system_profiler SPUSBDataType | grep -B 3 -i wacom | awk 'NR%5==1'
XD-0608-U:
PTZ-630:
If you ran
awk 'NR%5==3' instead
then you'd get every 3rd line of output of each block of 5
system_profiler SPUSBDataType | grep -B 3 -i wacom | awk 'NR%5==3'
Product ID: 0x0042
Product ID: 0x00b1
sed -e 's/^[ ]*//'
remove leading whitespace
These are hashed out, so aren't doing anything anymore
#sed -e 's/USB Bus://'
#sed -e 's/USB High-Speed Bus://'
but they are replacements. So
sed 's/hello/goodbye/'
will replace the first hello with goodbye
whilst sed 's/hello/goodbye/g'
will remove all instances of hello with goodbye
So from all of that,
s ed -e 's/XD-0405-U/Intuos2 A6/g'
replaces " XD-0405-U" with " Intuos2 A6" (notice the back slash to escape spaces)
Then | (pipe) one line into the next.
Rather that having one massive list though, you can use and then return to a new line to make it neater.
So,
system_profiler SPUSBDataType | grep -B 3 -i wacom | awk 'NR%5==1' |
sed -e 's/^[ ]*//'
Is the same as writing
system_profiler SPUSBDataType | grep -B 3 -i wacom | awk 'NR%5==1' | sed -e 's/^[ ]*//'
Google sed or awk oneliners. Very useful pages to start with.
I do the same with SDI/HD Video IO cards too. Which reminds me, I need to check out the unknowns!
#!/bin/bash
echo -n "<result>"
system_profiler SPPCIDataType | grep -B 2 "Type: Video" | sed 's/ //g' | grep '^pci' |
sed -e 's/pci10b5,a100:/Decklink Pro/' |
sed -e 's/pcibdbd,a11b:/Decklink SDI/' |
sed -e 's/pcibdbd,a117:/Decklink Intensity Pro/' |
sed -e 's/pcif1d0,c0ff:/AJA Kona 3/' |
sed -e 's/pcibdbd,a121:/Unknown/' |
sed -e 's/pcibdbd,a10b:/Blackmagic Unknown/'
echo "</result>"
Sean
sed 's/My shades/Oakleys/g'
:)
Sean,
Kudos for both the script and the explanation; my sed IQ has increased exponentially!
One question: if a computer does have more than one Wacom device connected, then how does it populate the Extension Attribute (I am trying to visualize how each device would be a separate variable if it populates a single attribute)?
Thanks again!
Sean
~~~~~~~~~
Sean Alexander
Desktop Analyst
Macintosh Services Delivery
Lockheed Martin - Enterprise Business Services
~~~~~~~~~
The script output in Casper has a return <BR> that the Extension Attribute obeys and each item will appear in a list.
I do a similar thing for graphics cards and I get:
Graphics Card: ATI Radeon HD 4870
NVIDIA Quadro 4000
Disappointingly, if you view this on the main Inventory page, then you get a display like:
ATI Radeon HD 4870<BR>NVIDIA Quadro 4000
since this page isn't obeying the return. I've put in a bug fix, but unless it is in the very latest build, Jamf still haven't fixed this. Anyone else annoyed by this please add a bug report to get it fixed.
So it is one variable, but each item is separated by a return. In fact, the appearance of multiple lines in Extension Attributes was better in version 7.x, as the Title would appear in line with the top item. They have changed this to centre, making our memory one look like:
Memory Banks: DIMM 1: 2 GB 0x26302779
DIMM 2: 2 GB 0x2690277B
DIMM 3: Empty Empty
DIMM 4: Empty Empty
DIMM 5: 2 GB 0x2690272A
DIMM 6: 2 GB 0x26202770
DIMM 7: Empty Empty
DIMM 8: Empty Empty
When this is in a list of attributes that each have several lines, it isn't the easiest to read. Put in a feature request to revert the style sheet, but again no change yet. Report this too, go on!
No doubt both of these display issues are in style sheets on the server that I could edit, but then each update would mean re-writing their style sheet each time.
Sean