Skip to content
David Kittell
David Kittell

Application & System: Development / Integration / Orchestration

  • Services
    • Application Development
    • Online Application Integration
  • Code
  • Online Tools
  • Tech Support
David Kittell

Application & System: Development / Integration / Orchestration

Mac OS X Terminal – Get Computer Information

Posted on September 1, 2016December 13, 2016 By David Kittell
clear

echo "Inventory Script - Running...."

# Variables - Start
# Get IP - Start
netadapter=en0
ip=$(ipconfig getifaddr $(echo $netadapter))
#echo $ip
#echo $netadapter

counter=1
while [ $counter -le 10 ]
do
if [ -z "$ip" ]
then
#echo $counter

netadapter=$(echo "en"$counter)
ip=$(ipconfig getifaddr "en"$counter)

fi
((counter++))
done
#echo $ip
#echo $netadapter

# Get IP - Stop

declare dDateTime=$(date +%Y_%m_%d)

# Variables - Stop

OSvers1=$( sw_vers -productVersion | cut -d. -f1 )
OSvers2=$( sw_vers -productVersion | cut -d. -f2 )
OSvers3=$( sw_vers -productVersion | cut -d. -f3 )

case $OSvers2 in
    8)
OSName="Mountain Lion"
;;
9)
OSName="Mavericks"
;;
10)
OSName="Yosemite"
;;
11)
OSName="El Capitan"
;;
12)
OSName="Sierra"
;;
default)
OSName="Unknown"
;;
esac

echo "      Computer OS: Mac OS X - $OSName $OSvers1.$OSvers2.$OSvers3" > ~/Desktop/$(whoami)_$(scutil --get ComputerName)_InventoryReport_$dDateTime.txt
echo "      Computer Name: $(scutil --get ComputerName)" >> ~/Desktop/$(whoami)_$(scutil --get ComputerName)_InventoryReport_$dDateTime.txt
echo "      User Name: $(whoami)" >> ~/Desktop/$(whoami)_$(scutil --get ComputerName)_InventoryReport_$dDateTime.txt
echo "      IP Address: $ip" >> ~/Desktop/$(whoami)_$(scutil --get ComputerName)_InventoryReport_$dDateTime.txt
echo "      Network Adapter: $netadapter" >> ~/Desktop/$(whoami)_$(scutil --get ComputerName)_InventoryReport_$dDateTime.txt
echo "      File Vault: $(fdesetup status)" >> ~/Desktop/$(whoami)_$(scutil --get ComputerName)_InventoryReport_$dDateTime.txt
/usr/sbin/system_profiler SPHardwareDataType | grep "Model Name" -A12 >> ~/Desktop/$(whoami)_$(scutil --get ComputerName)_InventoryReport_$dDateTime.txt

echo "Inventory Script - Completed"
Originally Posted on September 1, 2016
Last Updated on December 13, 2016
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.

Related

Code Mac OS X Shell Mac OSX UNIX UNIX Shell Scripts

Post navigation

Previous post
Next post

Related Posts

PowerShell – Get Computer Information

Posted on November 6, 2015November 10, 2015

This script is pieced together from various posts, I only take credit for combining the resources. There is more than initially is seen to this script, based on the code below it will write a text file on c:\ and does need admin privileges in order to run. Right around…

Read More

Enable/Disable Desktop Saves

Posted on November 9, 2013October 26, 2015

WARNING: Backup the computer you try these scripts on before you run these. These scripts will enable/disable the ability to save anything to the desktop. Windows Registry Editor Version 5.00 [HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionPoliciesExplorer] "NoSaveSettings"=dword:00000001 Windows Registry Editor Version 5.00 [HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionPoliciesExplorer] "NoSaveSettings"=dword:00000000 Originally Posted on November 9, 2013Last Updated on October 26, 2015…

Read More

Fitbit Import

Posted on June 22, 2015

This is a import process to import the steps recorded in MSN Health and Fitness Windows Phone app into Fitbit. Place holder for now as I get it working. References: https://github.com/aarondcoleman/Fitbit.NET https://github.com/cbowns/fitbit-oauth-perl/ https://wiki.fitbit.com/display/API/API+PHP+Client http://fitbit.jcs.org/ https://github.com/heyitspavel/fitbitphp/blob/master/fitbitphp.php http://www.staze.org/retrieving-steps-data-fitbit-api/ All information on this site is shared with the intention to help. Before any…

Read More

Code

Top Posts & Pages

  • PowerShell - Rename Pictures to Image Taken
  • Front Page
  • PowerShell - IIS Remove Site
  • SQLite - Auto-Increment / Auto Generate GUID
  • PowerShell - FTP Upload Directory With Sub-Directories

Recent Posts

  • Javascript – Digital Clock with Style
  • BASH – Web Ping Log
  • BASH – Picture / Video File Name Manipulation
  • Mac OSX Terminal – Create SSH Key
  • Bash – Rename Picture

Top Posts

  • PowerShell - Rename Pictures to Image Taken
  • PowerShell - IIS Remove Site
  • SQLite - Auto-Increment / Auto Generate GUID
  • PowerShell - FTP Upload Directory With Sub-Directories
  • Raspberry Pi - Remove Default Apps
  • PowerShell - Change Windows CD/DVD Drive Letter
©2025 David Kittell | WordPress Theme by SuperbThemes