mirror of
https://github.com/PurpleComputing/mdmscripts.git
synced 2026-02-03 06:03:26 +00:00
9 lines
403 B
Bash
9 lines
403 B
Bash
#!/bin/sh
|
|
|
|
FullName=$(sudo -u $(stat -f "%Su" /dev/console) id -F)
|
|
ComputerModel=$(/usr/sbin/system_profiler SPHardwareDataType | grep 'Model Name' | cut -d":" -f2)
|
|
ComputerName=$(echo $FullName$ComputerModel | sed -e "s/ /-/g" | sed -e "s/\./-/g" )
|
|
/usr/sbin/scutil --set HostName "$ComputerName"
|
|
/usr/sbin/scutil --set LocalHostName "$ComputerName"
|
|
/usr/sbin/scutil --set ComputerName "$ComputerName"
|