Last active
September 5, 2019 17:54
-
-
Save talkingmoose/5d0ca5f32dfa3532dc5eea6d5d25cb76 to your computer and use it in GitHub Desktop.
Renames Computer Name, Local Host Name and Host Name to serial number.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # read serial number | |
| serialNumber=$( /usr/sbin/system_profiler SPHardwareDataType | /usr/bin/grep "Serial Number" | /usr/bin/awk -F: '{ print $2 }' | /usr/bin/xargs ) | |
| # set the three computer names | |
| /usr/sbin/scutil --set ComputerName "$serialNumber" | |
| /usr/sbin/scutil --set HostName "$serialNumber" | |
| /usr/sbin/scutil --set LocalHostName "$serialNumber" | |
| exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment