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"
Last Updated on December 13, 2016