Skip to end of metadata
Go to start of metadata

Description

Need to know the full name of "Retina, 15-inch, Late 2013)" rather then the Model Identifier "MacBookPro11,3"
This script will look that name up and write it to inventory.

Ingredients

  • FW Admin
  • Proper text editor (like TextWrangler - OS X or notepad ++ - Windows)


Directions

  1. Make an empty fileset with a script that runs at activation.
  2. Is a command you can run on your local machine to find the name. You can test this command yourself in an macOS terminal window.

    curl -s https://support-sp.apple.com/sp/product?cc=`system_profiler SPHardwareDataType | awk '/Serial/ {print $4}' | cut -c 9-` | sed 's|.*<configCode>\(.*\)</configCode>.*|\1|'

    Use this code as an example to tell an macOS computer to take its serial number, make a query to Apple Inc. asking what it's name is, and then write that to FileWave Inventory. 


  3. #!/bin/sh 
    # benm @ fw 
    now=$(date +"%Y-%m-%d-%H-%M") 
    echo "$now -- Writing name to inventory "
    
    
    #writes the device name 
    fullname=$(curl -s https://support-sp.apple.com/sp/product?cc=`system_profiler SPHardwareDataType | awk '/Serial/ {print $4}' | cut -c 9-` | sed 's|.*<configCode>\(.*\)</configCode>.*|\1|')
    
    
    /usr/local/sbin/FileWave.app/Contents/MacOS/fwcld -custom_write -key custom_string_02 -value "$fullname"

Be sure to change "custom_string_02" to a string that another script isn't already using to prevent scripts overwriting each other.